Skip to content

virtual_machine_v2: VM creation fails with multiple NICs ("invalid input arguments") #994

@ec-mikacpe

Description

@ec-mikacpe

Nutanix Cluster Information

  • Nutanix AOS: 7.3.0.6
  • Prism Central: pc.7.3.0.6

Terraform Version

OpenTofu v1.9.0
on linux_amd64
+ provider registry.opentofu.org/hashicorp/template v2.2.0
+ provider registry.opentofu.org/nutanix/nutanix v2.3.1

Affected Resource(s)

  • nutanix_virtual_machine_v2

Terraform Configuration Files

resource "nutanix_virtual_machine_v2" "vm" {
  for_each             = var.vms
  name                 = each.value.name
  description          = each.value.description
  num_cores_per_socket = each.value.num_cores_per_socket
  num_sockets          = each.value.num_sockets
  memory_size_bytes    = each.value.memory_gb * local.gib

  cluster {
    ext_id = data.nutanix_clusters_v2.clusters.cluster_entities[0].ext_id
  }

  # Boot disk
  disks {
    disk_address {
      bus_type = "SCSI"
      index    = 0
    }
    backing_info {
      vm_disk {
        disk_size_bytes = each.value.boot_disk_size_gb * local.gib
        data_source {
          reference {
            image_reference {
              image_ext_id = local.image_ext_id
            }
          }
        }
      }
    }
  }

  # Additional disks
  dynamic "disks" {
    for_each = each.value.additional_disks
    content {
      disk_address {
        bus_type = "SCSI"
        index    = disks.value.index
      }
      backing_info {
        vm_disk {
          disk_size_bytes = disks.value.size_gb * local.gib
          dynamic "storage_container" {
            for_each = var.storage_container_ext_id != null ? [var.storage_container_ext_id] : []
            content {
              ext_id = storage_container.value
            }
          }
        }
      }
    }
  }

  # Multiple NICs (fails during apply)
  nics {
    network_info {
      nic_type  = "NORMAL_NIC"
      vlan_mode = "ACCESS"
      subnet {
        ext_id = "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
      }
    }
  }

  nics {
    network_info {
      nic_type  = "NORMAL_NIC"
      vlan_mode = "ACCESS"
      subnet {
        ext_id = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
      }
    }
  }

  boot_config {
    legacy_boot {
      boot_order = ["DISK", "CDROM", "NETWORK"]
    }
  }

  lifecycle {
    ignore_changes = [
      guest_customization,
      cd_roms,
      boot_config
    ]
  }
}

Debug Output

Gist: [https://gist.github.com/your-gist-link-here](https://gist.github.com/)


Panic Output

No panic output produced.


Expected Behavior

When multiple nics {} blocks are defined in the same nutanix_virtual_machine_v2 resource, Terraform / OpenTofu should successfully create a VM with all defined network interfaces attached to their respective subnets.


Actual Behavior

terraform plan displays both NICs correctly, but terraform apply fails with the following error for each VM:

plan:

      + nics {
          + ext_id = (known after apply)

          + backing_info {
              + is_connected = true
              + mac_address  = (known after apply)
              + model        = (known after apply)
              + num_queues   = 1
            }

          + network_info {
              + network_function_nic_type = (known after apply)
              + nic_type                  = "NORMAL_NIC"
              + should_allow_unknown_macs = (known after apply)
              + trunked_vlans             = (known after apply)
              + vlan_mode                 = "ACCESS"

              + ipv4_config (known after apply)

              + ipv4_info (known after apply)

              + network_function_chain (known after apply)

              + subnet {
                  + ext_id = "AAAAAAAAAAAAAAAAAAAAAAAAAAAA"
                }
            }
        }
      + nics {
          + ext_id = (known after apply)

          + backing_info {
              + is_connected = true
              + mac_address  = (known after apply)
              + model        = (known after apply)
              + num_queues   = 1
            }

          + network_info {
              + network_function_nic_type = (known after apply)
              + nic_type                  = "NORMAL_NIC"
              + should_allow_unknown_macs = (known after apply)
              + trunked_vlans             = (known after apply)
              + vlan_mode                 = "ACCESS"

              + ipv4_config (known after apply)

              + ipv4_info (known after apply)

              + network_function_chain (known after apply)

              + subnet {
                  + ext_id = "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
                }
            }
        }

Error: error waiting for virtual Machine (...) to create: error_detail: Failed to perform the operation 'NIC create' on the VM with UUID 'a113142a-360b-4eee-58f6-125703192663' and NIC with UUID '6f0a61d6-a037-49de-a857-a98883374305' due to invalid input arguments., progress_message: 100

The same configuration with only one nics {} block works perfectly.
Adding a second nics {} block — even with identical parameters — consistently fails with invalid input arguments.


Steps to Reproduce

  1. Define a VM with one NIC → terraform apply works correctly.
  2. Add a second nics {} block (either same subnet or different).
  3. Run terraform plan → plan shows both NICs correctly.
  4. Run terraform apply → creation fails with error_detail: Failed to perform the operation 'NIC create' ... invalid input arguments.

Important Factors

  • Using Prism Central API endpoint
  • Subnets are valid and on the same cluster
  • The same configuration works with a single NIC block
  • Attempted both with and without backing_info

References


Probably I try to configure it in the wrong way. In that case, please let me know the right way + update the documentation.

Thank you very much,

Best Regards,
Peter

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions