nutanix / terraform-provider-nutanix

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

Use disk uuid when applying disk properties changes #505

Open Bogdan-Busoi-EMR opened 2 years ago

Bogdan-Busoi-EMR commented 2 years ago

Right now, when changing a disk properties, the disks are identified by the order they have in the tfstate, so in the case of a VM with 4 disks, if I remove the second disk, the plugin considers that disks 3 and 4 also need to be changed, as the order changes, the 3rd disk now becomes the second and the 4th becomes the 3rd. Since among the optional attributes of the disks we have the uuid, a safer way to avoid this kind of situations or to make sure that we are applying the changes to the desired disk, I think that it would be useful to identify disks using the uuid first, if provided, and second by the order they have in the tfstate.