-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error deleting a VM linked to a backend address pool association #4330
Comments
I am trying to reproduce this issue in go sdk using this code snippet, but I did not reproduce this issue. When I change the order of destruction of each resource, it may fail, but with different error message. I suspect this is related with the order terraform execute the destruction of each resource. |
Given this is not-stable repro and related with the terraform resource deletion order, @tombuildsstuff to possibly comment on whether there could be any fundamental reason |
Thanks for opening this issue. Taking a look into this this appears to work as intended on v1.34:
Would you be able to take a look and see if upgrading fixes this issue for you? Since this appears to be fixed in 1.34 I'm going to close this issue for the moment but please let us know if this is still an issue after upgrading and we'll take another look. Thanks! |
@tombuildsstuff I upgraded to 1.34, tried again, and the destruction still fails for me with the same error:
Ran apply-destroy 3 times, got 3 errors. A subsequent destroy after the failure succeeds. I'm on Terraform 0.12.8 on Windows, running the copy-pasted script from the above (updated to |
@mikhailshilkov out of interest is there any organizational-wide policies applied to the Tenant/Subscription, e.g. Security Center? Whilst we could add locks within the VM resources deletion function on the NIC ID, the |
@tombuildsstuff It's my personal subscription that I use for test purposes, with no policies etc. |
Could someone explain why this is closed? We're seeing more dependency issues suddenly appearing in this same vein. I'll work on some reproduction code if needed, but this is clearly not a solved issue. |
@dbilleci-lightstream @mikhailshilkov , in addition to identify the root cause that could be related with the deletion dependency, may i suggest you have a try on the work around of using the depends_on feature in terraform? It explicitly declares the dependency among resources, though you need to understand ahead of time the correct dependency among VM, LB and Backend_Pool. We'll meanwhile try this workaround on our side and will update here for any of our progress. |
The |
@mikhailshilkov Which dependency have you added? Can you please paste your TF-file? |
@sorenhansendk In the TF-file from the original message, you should add a |
@mikhailshilkov Ok, I will try that 👍 Thank you for the quick response! |
@mikhailshilkov Hmm - the problem still exists for me. It this not what you mean? I have removed lot of configuration, that is what the resource "azurerm_virtual_machine" "vm" { ... depends_on = [azurerm_lb_backend_address_pool.nodes] } resource "azurerm_lb_backend_address_pool" "nodes" { ... } Error: Error waiting for removal of Backend Address Pool Association for NIC "XXX" (Resource Group "XXX"): Code="OperationNotAllowed" Message="Operation 'startTenantUpdate' is not allowed on VM 'XXX' since the VM is marked for deletion. You can only retry the Delete operation (or wait for an ongoing one to complete)." Details=[] |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
@sorenhansendk depending on the configuration being used you may need to add an explicit dependency on the Similar to the |
Community Note
Terraform (and AzureRM Provider) Version
Affected Resource(s)
azurerm_network_interface_backend_address_pool_association
azurerm_lb_backend_address_pool
azurerm_virtual_machine
Terraform Configuration Files
Expected Behavior
The resources can be successfully created and
terraform apply
and deleted withterraform destroy
.Actual Behavior
terraform destroy
fails withSince there's no dependency between the VM and the Backend Address Pool resources, the pool is deleted before the VM, which causes to VM deletion errror. VM deletion should handle this situation gracefully. Alternatively, the resource model should be adjusted to prevent the backend pool association to be deleted before the VM.
Steps to Reproduce
terraform apply
terraform destroy
The text was updated successfully, but these errors were encountered: