I am trying to create VMs on my proxmox cluster using Terraform and a Proxmox VM template.
i have created a Proxmox VM template following this guide https://tcude.net/creating-a-vm-template-in-proxmox/ and used a simple Terraform main.tf config with Telmate provider for Proxmox from my pc. Here is my main.tf file -
terraform {
required_providers {
proxmox = {
source = "Telmate/proxmox"
version = "3.0.1-rc3"
}
}
}
provider "proxmox" {
pm_api_url = "https://xxxxx:8006/api2/json"
pm_user = "xyz@pve"
pm_password = "xyz" # Or use an API token
pm_tls_insecure = true
pm_debug = true
pm_log_enable = true
}
resource "proxmox_vm_qemu" "my_test_vms" {
count = 1
name = "Test-vm-${count.index + 1}"
onboot = true
vm_state = "running"
target_node = "xxx"
memory = 2048
cores = 2
sockets = 1
clone = "template-name"
network {
model = "virtio"
bridge = "vmbr0"
}
ipconfig0 = "ip=dhcp"
}
https://registry.terraform.io/providers/Telmate/proxmox/latest/docs
This gives me a VM with no cloud-init drive and a state of continuous boots like the pic attached.
The Ubuntu OS doesn't startup.
Now , if I remove bridge="vmbr0" and ipconfig0="ip=dhcp". This creates a VM with the following error.
proxmox_vm_qemu.my_test_vms[0]: Creating...
proxmox_vm_qemu.my_test_vms[0]: Still creating... [10s elapsed]
╷
│ Error: error updating VM: 500 no sdn vnet ID specified, error status: {"data":null} (params: map[agent:0 bios:seabios cores:2 cpu:host delete:ide2,scsi0 hotplug:network,disk,usb kvm:true memory:2048 name:Test-vm-1 net0:virtio=5E:74:ED:5A:07:CC numa:false onboot:true protection:false scsihw:lsi sockets:1 tablet:true vmid:102])
│
│ with proxmox_vm_qemu.my_test_vms[0],
│ on main.tf line 20, in resource "proxmox_vm_qemu" "my_test_vms":
│ 20: resource "proxmox_vm_qemu" "my_test_vms" {
│
How do I rectify this?
i have created a Proxmox VM template following this guide https://tcude.net/creating-a-vm-template-in-proxmox/ and used a simple Terraform main.tf config with Telmate provider for Proxmox from my pc. Here is my main.tf file -
terraform {
required_providers {
proxmox = {
source = "Telmate/proxmox"
version = "3.0.1-rc3"
}
}
}
provider "proxmox" {
pm_api_url = "https://xxxxx:8006/api2/json"
pm_user = "xyz@pve"
pm_password = "xyz" # Or use an API token
pm_tls_insecure = true
pm_debug = true
pm_log_enable = true
}
resource "proxmox_vm_qemu" "my_test_vms" {
count = 1
name = "Test-vm-${count.index + 1}"
onboot = true
vm_state = "running"
target_node = "xxx"
memory = 2048
cores = 2
sockets = 1
clone = "template-name"
network {
model = "virtio"
bridge = "vmbr0"
}
ipconfig0 = "ip=dhcp"
}
https://registry.terraform.io/providers/Telmate/proxmox/latest/docs
This gives me a VM with no cloud-init drive and a state of continuous boots like the pic attached.
The Ubuntu OS doesn't startup.
Now , if I remove bridge="vmbr0" and ipconfig0="ip=dhcp". This creates a VM with the following error.
proxmox_vm_qemu.my_test_vms[0]: Creating...
proxmox_vm_qemu.my_test_vms[0]: Still creating... [10s elapsed]
╷
│ Error: error updating VM: 500 no sdn vnet ID specified, error status: {"data":null} (params: map[agent:0 bios:seabios cores:2 cpu:host delete:ide2,scsi0 hotplug:network,disk,usb kvm:true memory:2048 name:Test-vm-1 net0:virtio=5E:74:ED:5A:07:CC numa:false onboot:true protection:false scsihw:lsi sockets:1 tablet:true vmid:102])
│
│ with proxmox_vm_qemu.my_test_vms[0],
│ on main.tf line 20, in resource "proxmox_vm_qemu" "my_test_vms":
│ 20: resource "proxmox_vm_qemu" "my_test_vms" {
│
How do I rectify this?