Skip to content

Commit

Permalink
data/data/azure/bootstrap: ensure pool is only updated after machine …
Browse files Browse the repository at this point in the history
…is terminated

It looks like an internal Azure race is causing a cryptic message like

```
Error: Error waiting for removal of Backend Address Pool Association for NIC \"ci-op-8qv3w054-282fe-2222c-bootstrap-nic\" (Resource Group \"ci-op-8qv3w054-282fe-2222c-rg\"): Code=\"OperationNotAllowed\" Message=\"Operation 'startTenantUpdate' is not allowed on VM 'ci-op-8qv3w054-282fe-2222c-bootstrap' since the VM is marked for deletion. You can only retry the Delete operation (or wait for an ongoing one to complete).\" Details=[]
```

when we update the NIC and the machine attached to it.

`azurerm_network_interface_backend_address_pool_association.` depends on NIC but is not related to the machine NIC is attached to, the VM might be shutting down while this update is happeninig. This depends_on makes sure that VM is destroyed before we try to delete this association, preventing the race.

Similar error seen by people like Azure/azure-rest-api-specs#7207
  • Loading branch information
abhinavdahiya authored and jhixson74 committed Dec 6, 2019
1 parent 7fdcd39 commit 58403d7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions data/data/azure/bootstrap/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ resource "azurerm_virtual_machine" "bootstrap" {
enabled = true
storage_uri = var.storage_account.primary_blob_endpoint
}

depends_on = [
azurerm_network_interface_backend_address_pool_association.public_lb_bootstrap,
azurerm_network_interface_backend_address_pool_association.internal_lb_bootstrap
]
}

resource "azurerm_network_security_rule" "bootstrap_ssh_in" {
Expand Down

0 comments on commit 58403d7

Please sign in to comment.