When two swappable cloud service extended support are created via Terraform with an ARM template, how can I delete the old one after the swap when its public IP is now linked to the new one?
Frank van Eykelen
131
Reputation points
- I have two cloud services extended support that have been made swappable
- Both are created via Terraform with an ARM template for the Cloud Service
- During the deploy (terraform apply) the resources like the load balancer and public IP address are created implicitly
- When I only had one unswappable cloud service extended support I could run a
terraform apply -destroy
without any issues - Now, after I have performed a swap (by configuring
SwappableCloudService
in the ARM template and running a POST on the setLoadBalancerFrontendPublicIpAddresses API) this no longer seems to work: the destroy hangs on deleting its public IP address.
My guess is that the destroy fails because the IP swap has changed the resources (assigning the IP of the "Staging" cloud service to the "Production" cloud service) without updating the state file, which causes the destroy to hang and fail eventually.
Please note that the docs explicitly mention the option to delete it:
To save compute costs, you can delete one of the cloud services (designated as a staging environment for your application deployment) after you verify that your swapped cloud service works as expected.
So how do I make this work?
Sign in to answer