We have a Windows VM deployed on Azure via Terraform. We are using 11.14 due to issue 22006. This VM is provisioned via additional resources to create and run a Docker image. This Docker image will need to be updated occasionally and we hoped that adding create_before_destroy to all of the resources might allow us to replace the VM with almost zero downtime. When we ran an apply to test this, the output messages indicated that the new VM and all associated resources were created successfully, followed by messages that the VM and all associated resources were deposed and destroyed. Finally, the output stated that an error occurred applying the plan. A more detailed message is displayed that “The Resource ‘Microsoft.Compute/virtualMachines/eastus2-app-testserver’ under resource group ‘eastus2-app-test’ was not found.” There is no eastus2-app-testserver included in the Terraform script so perhaps this is the internal name assigned to the new VM? The final result is that neither the old VM nor the replacement VM exists in Azure. Should it be possible to replace a VM via create_before_destroy with Terraform?
Sorry, I made a mistake in the original post. I was looking at the wrong var, and the eastus2-app-testserver name is from the Terraform script and not an internal name. Another bit of information that might be worth noting is that the IP for the replacement VM is the same as for the existing VM.