terraform-provider-proxmox: cloud-init no longer working.
Hi guys, I’ve been reading the issues and can’t get my head around the fix needed to be able to run cloudinit templates. Luckily by old system still works, but I’m trying to implement it on a second promox system and I guess since some update it has broken. Could anyone please give feedback on what I am doing wrong?
I was able to make it so it at least starts creating the VMs, but now I get the error “Boot failed: no bootable disk.” I can’t seem to figure out what I am doing wrong.
terraform {
required_providers {
proxmox = {
source = "telmate/proxmox"
version = "3.0.1-rc1"
}
}
}
provider "proxmox" {
# url is the hostname Add /api2/json at the end for the API
pm_api_url = "http://198.18.202.11:8006/api2/json"
# api token id is in the form of: <username>@pam!<tokenId>
pm_api_token_id = "terraform@pam!new_token_id"
# this is the full secret wrapped in quotes.
pm_api_token_secret = "x"
# leave tls_insecure set to true unless proxmox SSL
pm_tls_insecure = true
}
variable "vm_configs" {
description = "Configuration for VMs"
type = map
default = {
velociraptor = {
name = "velociraptor"
memory = 2048
ip_address = "198.18.202.210"
cores = 2
storage = "local-lvm"
storage_size = "10G"
},
plaso = {
name = "plaso"
memory = 4096
ip_address = "198.18.202.211"
cores = 2
storage = "local-lvm"
storage_size = "20G"
}
# Add other VM configurations as needed
}
}
resource "proxmox_vm_qemu" "vms" {
for_each = var.vm_configs
name = each.value["name"]
target_node = var.proxmox_host
clone = var.template_name
agent = 1
os_type = "cloud-init"
cores = each.value["cores"]
sockets = 1
cpu = "host"
memory = each.value["memory"]
scsihw = "virtio-scsi-pci"
bootdisk = "scsi0"
disks {
virtio {
virtio0 {
disk {
size = 20
cache = "writeback"
storage = "local-lvm"
}
}
}
}
network {
model = "virtio"
bridge = "vmbr0"
}
lifecycle {
ignore_changes = [
network,
]
}
ipconfig0 = "ip=${each.value["ip_address"]}/24,gw=198.18.201.1"
sshkeys = <<EOF
${var.ssh_key}
EOF
}
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 22 (2 by maintainers)
With this code, it works :
proxmox_vm_qemu.tf:cloud-init.cloud_config_user.tftpl:Thank you @jaket91-1, after matching disk with my template, now it work and no duplicate unused disk.
@JGHLab looks like you have a mismatch between the bootdisk and the disks definition. You probably need to change the bootdisk to
virtio0or change the disks definition to be scsi like below. I had the same problem with cloning, the template disk wasscsi0but TF was creating avirtio0disk: