APT-Lab-Terraform
APT-Lab-Terraform copied to clipboard
LabBuilder.py: destroy option does not work on shutdown VMs
Reproduction:
- Create lab environment green-field using the LabBuilder.py script.
- Shutdown the VMs through Azure Portal or through the OS running in the VM.
- Run the LabBuilder.py script with "-destroy".
This results in:
- ws01 being destroyed, but dc and linux still being there.
- The following error message:
Error: compute.VirtualMachineExtensionsClient#Delete: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=<nil> Code="OperationNotAllowed" Message="Cannot modify extensions in the VM when the VM is not running."
Error: compute.VirtualMachineExtensionsClient#Delete: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=<nil> Code="OperationNotAllowed" Message="Cannot modify extensions in the VM when the VM is not running."
Potential work-around: simply kill the "class-resources" resource group in one blow :)
Researched some upstream project issues and found this. Looks to me like this is solved by using the azure_linux_virtual_machine and/or azure_windows_virtual_machine resources in the azurerm v2+ provider. This project locks the provider version at 1.27 so the resources with the extra capabilities aren't available at present.