Skip to content

Commit

Permalink
Remove retries for bad request error when attaching a volume to an in…
Browse files Browse the repository at this point in the history
…stance
  • Loading branch information
morozovalekseywot committed Jan 27, 2025
1 parent f9acc98 commit d78056f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ description: |-

#### v0.9.2 (unreleased)
- Reduce the minimum number of DHCP ports to wait for a subnet to be ready from 2 to 1
- Remove retries for bad request error when attaching a volume to a Compute instance

#### v0.9.1
- Fix panic on VKCS Kubernetes API error in vkcs_kubernetes_security_policy
Expand Down
12 changes: 3 additions & 9 deletions vkcs/compute/resource_volume_attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@ import (
"log"
"time"

"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/volumeattach"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/vk-cs/terraform-provider-vkcs/vkcs/blockstorage"
"github.com/vk-cs/terraform-provider-vkcs/vkcs/internal/clients"
"github.com/vk-cs/terraform-provider-vkcs/vkcs/internal/util"
"github.com/vk-cs/terraform-provider-vkcs/vkcs/internal/util/errutil"

"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/volumeattach"
ivolumeattach "github.com/vk-cs/terraform-provider-vkcs/vkcs/internal/services/compute/v2/volumeattach"
"github.com/vk-cs/terraform-provider-vkcs/vkcs/internal/util"
)

func ResourceComputeVolumeAttach() *schema.Resource {
Expand Down Expand Up @@ -90,10 +88,6 @@ func resourceComputeVolumeAttachCreate(ctx context.Context, d *schema.ResourceDa
err = retry.RetryContext(ctx, timeout, func() *retry.RetryError {
attachment, err = ivolumeattach.Create(computeClient, instanceID, attachOpts).Extract()
if err != nil {
if errutil.Is(err, 400) {
return retry.RetryableError(err)
}

return retry.NonRetryableError(err)
}

Expand Down

0 comments on commit d78056f

Please sign in to comment.