hashicorp/go-azure-sdk

Error running post-test destroy - unexpected status 409 with error: RequestConflict: Cannot modify resource

Orexii opened this issue · 1 comments

Orexii commented

Hello, I am receiving the following error when trying to run the test TestAccNetAppVolume_updateExportPolicyRule from the main branch of the terraform-provider-azurerm repo. The error seems to be occurring due to calling the function UpdateThenPoll, which I believe is pulled in from this pandora repo. Here is the error:

user [ ~/go/src/github.com/terraform-providers/terraform-provider-azurerm ]$ make acctests SERVICE='netapp' TESTARGS=' -parallel 1 -run=TestAccNetAppVolume_updateExportPolicyRule' TESTTIMEOUT='1200m'
==> Checking that code complies with gofmt requirements...
==> Checking that Custom Timeouts are used...
==> Checking that acceptance test packages are used...
TF_ACC=1 go test -v ./internal/services/netapp -parallel 1 -run=TestAccNetAppVolume_updateExportPolicyRule -timeout 1200m -ldflags="-X=github.com/hashicorp/terraform-provider-azurerm/version.ProviderVersion=acc"
=== RUN   TestAccNetAppVolume_updateExportPolicyRule
=== PAUSE TestAccNetAppVolume_updateExportPolicyRule
=== CONT  TestAccNetAppVolume_updateExportPolicyRule
    testcase.go:113: Step 3/4 error: Error running apply: exit status 1

        Error: updating Volume (Subscription: "<sub ID>"
        Resource Group Name: "acctestRG-netapp-240213093738273849"
        Net App Account Name: "acctest-NetAppAccount-240213093738273849"
        Capacity Pool Name: "acctest-NetAppPool-240213093738273849"
        Volume Name: "acctest-NetAppVolume-240213093738273849"): polling after Update: `result.Status` was nil/empty - `op.Status` was "Patching" / `op.Properties.ProvisioningState` was ""

          with azurerm_netapp_volume.test,
          on terraform_plugin_test.tf line 93, in resource "azurerm_netapp_volume" "test":
          93: resource "azurerm_netapp_volume" "test" {

    testing_new.go:90: Error running post-test destroy, there may be dangling resources: exit status 1

        Error: deleting replicate Volume (Subscription: "<sub ID>"
        Resource Group Name: "acctestRG-netapp-240213093738273849"
        Net App Account Name: "acctest-NetAppAccount-240213093738273849"
        Capacity Pool Name: "acctest-NetAppPool-240213093738273849"
        Volume Name: "acctest-NetAppVolume-240213093738273849"): unexpected status 409 with error: RequestConflict: Cannot modify resource with id '/subscriptions/<sub ID>/resourceGroups/acctestRG-netapp-240213093738273849/providers/Microsoft.NetApp/netAppAccounts/acctest-NetAppAccount-240213093738273849/capacityPools/acctest-NetAppPool-240213093738273849/volumes/acctest-NetAppVolume-240213093738273849' because the resource entity provisioning state is not terminal. Please wait for the provisioning state to become terminal and then retry the request.

--- FAIL: TestAccNetAppVolume_updateExportPolicyRule (465.32s)
FAIL
FAIL    github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp        465.327s
FAIL
make: *** [GNUmakefile:99: acctests] Error 1
user [ ~/go/src/github.com/terraform-providers/terraform-provider-azurerm ]$

Any insight on what is causing this would be helpful. My colleague @paulomarquesc is also experiencing this issue when running this test, therefore I am inclined to believe others may experience the issue as well if attempted to be reproduced.

Possible relevant information:

$ terraform version
Terraform v1.7.3
on linux_amd64
$ go version
go version go1.21.6 linux/amd64

hey @Orexii

Thanks for opening this issue.

Taking a look into this one it appears that the API is returning Patching as the value for provisioningState which isn't expected, and is what's causing this error - as such I've opened #888 to fix this one by adding support for that status code.

Since this issue is related to hashicorp/go-azure-sdk (since that's where the Base Layer used by the SDK is located) rather than hashicorp/pandora however, I hope you don't mind but I'm going to move this issue over to that repository.

Thanks!