nutanix / terraform-provider-nutanix

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

Agent VM status is deleted on update #675

Open davhdavh opened 4 months ago

davhdavh commented 4 months ago

Nutanix Cluster Information

AOS 6.5.1.6 LTS

Terraform Version

1.5.5

Affected Resource(s)

resource "nutanix_virtual_machine" "linux" { count = length(local.hosts) name = "linux${count.index + 1}" cluster_uuid = local.cluster.metadata.uuid

num_vcpus_per_socket = 4 memory_size_mib = 48000 ... }


### Debug Output

### Panic Output
Error: error waiting for vm (c846afbf-4676-4e58-a1a2-195c6cc57f36) to update: error_detail: INVALID_ARGUMENT: Could not power on VM linux2. HA reservations are configured to tolerate 1 host failure(s). The VM-host affinity policy should specify at least 2 hosts to affine against. Alternatively, disable HA protection for the VMs by marking them as agent VM., progress_message: update_vm
│
│ with nutanix_virtual_machine.linux[1],
│ on inline-module.tf line 93, in resource "nutanix_virtual_machine" "linux":
│ 93: resource "nutanix_virtual_machine" "linux" {
│

### Expected Behavior
update to .tf file would NOT alter the Agent VM setting on the host
### Actual Behavior
update to .tf file DOES alter the Agent VM setting to FALSE, which causes the VM to be unable to boot since it is fixed to 1 physical host.
### Steps to Reproduce
1. `terraform apply` with a vm
2. Manually mark vm as Agent VM and bind to 1 physical host (because the nutanix terraform provider doesn't support these settings)
3. update any config that requires a reboot, such as cpu or memory, and `terraform apply`