Closed kalenarndt closed 2 years ago
Hi @kalenarndt, the nsxt_policy_vm_tags
was fixed not to error out on update/delete if vm is no longer present. However, nsxt_policy_vm
data source would still error out if VM not found, since this is the expected behavior. In order to avoid this, you can use new nsxt_policy_vms
data source that provides you with all VMs in the inventory, and the flexibility to lookup/change vm id values according to your logic.
Hope this helps!
Describe the bug
If a VM has been removed from a Computer Manager that had tags previously assigned then it causes the run to fail because the lookup of the VMID errors. You either need to target destroy the resource or modify the state in order to continue to execute the run normally.
Here is the error that you receive:
Error: Error during Virtual Machine retrieval: Could not find Virtual Machine with ID: 50250046-fccc-9449-b149-8aed149fa7f7 with module.nsxt-cts-dfw.nsxt_policy_vm_tags.tags["web03"] on . terraform/modules/nsxt-cts-dfw/main.tf line 32, in resource "nsxt_policy. vm_tags" "tags":
Reproduction steps
Expected behavior
If the VM has been removed from the inventory of the Compute Managers then we shouldn't attempt to unassign the tag if we are unable to locate the object in inventory or the error shouldn't be passed causing the run to fail.
Additional context
No response