I'm trying to create a new machine on Nutanix with terraform v0.15.0 and assign the machine to an existing project I already have (created on the UI without terraform).
Using the Nutanix documentation
(https://registry.terraform.io/providers/nutanix/nutanix/latest/docs/resources/virtual_machine#project_reference) , I was able to create a VM, but not assign it to the existing project.
Using this main.tf works, however, uncommenting the project_reference attribute results in the following error:
nutanix_virtual_machine.vm1[0]: Creating...
Error: error: {
"api_version": "3.1",
"code": 422,
"message_list": [
{
"details": {
"metadata": [
"Additional properties are not allowed (u'project_reference' was unexpected)"
]
},
"message": "Request could not be processed.",
"reason": "INVALID_REQUEST"
}
],
"state": "ERROR"
}
on main.tf line 67, in resource "nutanix_virtual_machine" "vm1":
67: resource "nutanix_virtual_machine" "vm1" {
Here's my code:
provider "nutanix" {
username = "user"
password = "pass"
port = 1234
endpoint = "ip"
insecure = true
wait_timeout = 10
}
data "nutanix_cluster" "cluster" {
name = "NTNXCluster"
}
data "nutanix_image" "ubuntu-clone" {
image_name = "Ubuntu-20.04-Server"
}
variable "counter" {
type = number
default = 1
}
resource "nutanix_virtual_machine" "vm1" {
name = "test-${count.index+1}"
count = var.counter
description = "desc"
num_vcpus_per_socket = 2
num_sockets = 2
memory_size_mib = 4096
guest_customization_sysprep = {}
cluster_uuid = "my_uuid"
nic_list {
subnet_uuid = "my_uuid"
}
#project_reference = {
# kind = "project"
# uuid = "my_uuid"
# name = "my_project"
#}
disk_list {
data_source_reference = {
kind = "image"
uuid = data.nutanix_image.ubuntu-clone.id
}
device_properties {
disk_address = {
device_index = 0
adapter_type = "SATA"
}
device_type = "DISK"
}
}
}