nutanix / terraform-provider-nutanix

Terraform Nutanix Provider
https://www.terraform.io/docs/providers/nutanix/
Mozilla Public License 2.0
95 stars 111 forks source link

When using guest_customization_sysprep on a Windows mashine it will always be destroyed when changing the number of vms #577

Open DevTown opened 1 year ago

DevTown commented 1 year ago

Is your feature request related to a problem? Please describe. I try to generate a Terraform template to dynamically run 10 to 100 Windows VMs. So now when I decrease the number of VMs, the terraform plan say that all VMs will be destroyed because of "guest_customization_sysprep" and create the new amount as new VMs and run sysprep.

Describe the solution you'd like If I change the number of VMs in a task, only the VMs that are over the count should be destroyed and not the ones that are already fine and run.

kifediniru393 commented 1 year ago

have you tried using the for_each meta arguments, I assume you are using count and the change in vm count is messing up the indexing in the tf_state file.