nutanix / terraform-provider-nutanix

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

Unable to add a second NIC to an existing VM #651

Open Golgautier opened 1 year ago

Golgautier commented 1 year ago

I created a VM with TF. This VM got a unique NIC on Primary network. Then I added a NIC in the TF file. It failed during apply.

Nutanix Cluster Information

Terraform Version

Affected Resource(s)

Terraform Configuration Files

data "nutanix_image" "image" {
  image_name = var.nutanix_image
}

data "nutanix_subnet" "subnet" {
  subnet_name = "Primary"
}

data "nutanix_subnet" "subnet2" {
  subnet_name = "Secondary"
}

resource "nutanix_virtual_machine" "bastion" {
  name = "test-gautier"
  boot_type = "UEFI"
  cluster_uuid = "xxx"

  guest_customization_cloud_init_user_data = base64encode(file("./cloud-init/simple.yaml"))

  disk_list {
    disk_size_mib = 50000
    data_source_reference = {
      kind = "image"
      uuid = data.nutanix_image.image.id
    }
  }

  disk_list {
    disk_size_mib = 10000
    device_properties {
      device_type = "DISK"
      disk_address = {
        "adapter_type" = "SCSI"
        "device_index" = "1" # /dev/sdb
      }
    }
  }

  nic_list {
    subnet_uuid = data.nutanix_subnet.subnet.id
  }

  nic_list {
    subnet_uuid = data.nutanix_subnet.subnet2.id
  }

  num_vcpus_per_socket = "4"
  num_sockets = "1"
  memory_size_mib = "8192"

  lifecycle {
      ignore_changes = [
          guest_customization_cloud_init_user_data,
          cluster_uuid,
          disk_list["data_source_reference"]
      ]
  }
}

Debug Output

See attached file tf.log

Expected Behavior

Add the new NIC

Actual Behavior

Crash

Steps to Reproduce

Deploy VM with only one nic_list then add the second one and apply it again

  1. terraform apply

Important Factors

N/A ​

References

N/A

Golgautier commented 1 year ago

Note : I tried terraform 1.6.4 and behaviour is the same.