You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Should have been able to terraform apply twice in a row.
Actual Behavior
Got the following error on the second invocation of terraform apply:
Error: Error applying plan:
1 error(s) occurred:
* azurerm_managed_disk.data (destroy): 1 error(s) occurred:
* azurerm_managed_disk.data: compute.DisksClient#Delete: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=<nil> Code="OperationNotAllowed" Message="Disk data0 is attached to VM /subscriptions/6364n0q5-8673-6794-1718-141s4pp87spr/resourceGroups/test/providers/Microsoft.Compute/virtualMachines/test0."
Steps to Reproduce
terraform init
terraform apply
terraform apply
Additional Context
We actually operate with counts other than "1"; I discovered this issue when trying to increase the count from 4 to 5. I then realized I was seeing the error even when the count was not changed.
References
I looked at the following issues (before I realized the problem occurred even when the count remained the same):
Based on this comment, changed from element syntax: managed_disk_id = "${element(azurerm_managed_disk.data.*.id,count.index)}"
to array syntax: managed_disk_id = "${azurerm_managed_disk.data.*.id[count.index]}"
Based on this comment, added the following to the azurerm_managed_disk resource:
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
ghost
locked and limited conversation to collaborators
Mar 31, 2020
This issue was closed.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Terraform Version
Terraform Configuration Files
terraform.tfvars (with bogus credentials):
infrastructure.tf:
Debug Output
Debug output (with bogus credentials) is here.
Expected Behavior
Should have been able to
terraform apply
twice in a row.Actual Behavior
Got the following error on the second invocation of
terraform apply
:Steps to Reproduce
terraform init
terraform apply
terraform apply
Additional Context
We actually operate with counts other than "1"; I discovered this issue when trying to increase the count from 4 to 5. I then realized I was seeing the error even when the count was not changed.
References
I looked at the following issues (before I realized the problem occurred even when the count remained the same):
Azure Official Example fails when augmenting it with a count logic to support VM scaling
Azure Official Example fails when augmenting it with a count logic to support VM scaling
Azure Example fails when augmenting it with count to support VM scaling
Increasing Count of Elements causes Plan with destruction of all previous
Please allow data disks to be added to existing machines in inventory in-line without destroy/recreate
Two of the things I tried (to no avail) were:
Based on this comment, changed from element syntax:
managed_disk_id = "${element(azurerm_managed_disk.data.*.id,count.index)}"
to array syntax:
managed_disk_id = "${azurerm_managed_disk.data.*.id[count.index]}"
Based on this comment, added the following to the azurerm_managed_disk resource:
The text was updated successfully, but these errors were encountered: