APT-Lab-Terraform icon indicating copy to clipboard operation
APT-Lab-Terraform copied to clipboard

LabBuilder.py: destroy option does not work on shutdown VMs

Open tsluyter opened this issue 4 years ago • 2 comments

Reproduction:

  1. Create lab environment green-field using the LabBuilder.py script.
  2. Shutdown the VMs through Azure Portal or through the OS running in the VM.
  3. Run the LabBuilder.py script with "-destroy".

This results in:

  1. ws01 being destroyed, but dc and linux still being there.
  2. 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."

tsluyter avatar Dec 31 '20 14:12 tsluyter

Potential work-around: simply kill the "class-resources" resource group in one blow :)

tsluyter avatar Dec 31 '20 14:12 tsluyter

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.

ghost avatar Feb 02 '21 19:02 ghost