vm creation fails with example usage
Opened this issue · 6 comments
Error: error creating VM: 422 Unprocessable Entity
│ {
│ "vm_create.devices": [
│ {
│ "message": "Field was not expected",
│ "errno": 22
│ }
│ ]
│ }
│
│ with truenas_vm.vm3,
│ on vms.tf line 1, in resource "truenas_vm" "vm3":
│ 1: resource "truenas_vm" "vm3" {
Thankyou for this Terraform provider.
I can successfully create datasets, but not VMs with devices.
If I comment out the devices, the VM is succesfully created.
Could you post the example resource that is failing? Also, please include version of TrueNAS you are using, thanks.
TrueNAS-SCALE-22.12.0
thankyou
resource "truenas_vm" "vm3" {
name = "TestVM3"
description = "Test VM3"
vcpus = 2
bootloader = "UEFI"
autostart = true
time = "UTC"
shutdown_timeout = "10"
cores = 4
threads = 2
memory = 1073741824
device {
attributes = {
type = "VIRTIO"
mac = "00:a0:98:39:5b:78"
nic_attach = "vlan80"
}
type = "NIC"
}
device {
attributes = {
path = "/dev/zvol/data-temp/dev-3qsqd"
type = "AHCI"
physical_sectorsize = null
logical_sectorsize = null
}
type = "DISK"
}
device {
attributes = {
wait = false
port = 9736
resolution = "1024x768"
bind = "0.0.0.0"
password = ""
web = true
type = "VNC"
}
type = "DISPLAY"
}
}
Hm, this is Bluefin, I only tested it with Angelfish. I may need to install this new version and see if maybe APIs changed or this is in fact some bug.
Yeah, I can confirm, they removed devices
field in Bluefin train and it seems the only way to add them is through separate endpoint, this will need some work. Also, not sure yet how I will handle both versions, since I'm sure there are still a lot of people on Angelfish. It may need to be a flag in provider configuration block.
I'm not sure it's the exact same problem, but I also can't get the vm creation example to work.
Here's what I get against TRUENAS 13.0.x
truenas_vm.vm: Creating...
╷
│ Error: error creating VM: 422 Unprocessable Entity
│ {
│ "devices": [
│ {
│ "message": "Item#0 is not valid per list types: [dtype] Invalid choice: DISPLAY",
│ "errno": 22
│ }
│ ]
│ }
│
│ with truenas_vm.vm,
│ on main.tf line 7, in resource "truenas_vm" "vm":
│ 7: resource "truenas_vm" "vm" {
Seems that DISPLAY is not a supported device Type.
I'm new to Terraform, so I'm not sure where I could get this info: where is the list of possible device Type ?
Yeah Im not surprised, TrueNAS has so many different versions and they all have API differences, this was originally implemented for Angelfish.. I don't have bandwidth to have support for all of them, working on it but it will take time.