Closed ynnckvdv closed 1 week ago
+1
https://github.com/Telmate/terraform-provider-proxmox/issues/863#issuecomment-1916274439
upping the provider to 3... release candidate helped:
terraform {
required_version = ">= 0.13.0"
required_providers {
proxmox = {
source = "telmate/proxmox"
version = "3.0.1-rc3"
# version = ">= 2.9.14"
}
}
}
@zehndi77 Strange, because I am on 3.0.1-rc3
. See the last line of my attached code block in my post.
@ynnckvdv
i have just today succeeded with the following setup:
https://github.com/thesheff17/tf_examples/blob/main/create_vm_9000.sh
used this script to provision the clone, but replaces scsi with virtio:
qm set 9000 --scsi0 local-lvm:0,import-from=/root/jammy-server-cloudimg-amd64.img qm set 9000 --boot order=scsi0
qm set 9000 --virtio0 local-lvm:0,import-from=/root/jammy-server-cloudimg-amd64.img qm set 9000 --boot order=virtio0
you might need to install the virt-customize tools for this script:
apt install libguestfs-tools -y
then I used this .tf file to provision the VM:
https://github.com/Telmate/terraform-provider-proxmox/blob/v3.0.1-rc3/examples/cloudinit_example.tf
adapted to my local needs:
# Proxmox Full-Clone
# ---
# Create a new VM from a clone
resource "proxmox_vm_qemu" "vm-test-01" {
# VM General Settings
target_node = "gladsheim"
vmid = "9001"
name = "vm-test-01"
desc = "Description"
# VM OS Settings
clone = "VM 9000"
# VM Network Settings
network {
bridge = "vmbr0"
model = "virtio"
tag = 1337
}
agent = 1
automatic_reboot = true
#balloon = 0
#bios = "seabios"
boot = "order=virtio0;ide2"
cores = 2
cpu = "host"
define_connection_info = true
force_create = false
hotplug = "network,disk,usb"
kvm = true
memory = 2048
numa = false
onboot = false
vm_state = "running"
#qemu_os = "l26"
#scsihw = "virtio-scsi-pci"
sockets = 1
protection = false
#tablet = true
vcpus = 0
# VM Disk Settings
disks {
ide {
ide2 {
cloudinit {
storage = "local-lvm"
}
}
}
virtio {
virtio0 {
disk {
backup = true
cache = "none"
discard = true
# emulatessd = true
# iothread = true
# mbps_r_burst = 0.0
# mbps_r_concurrent = 0.0
# mbps_wr_burst = 0.0
# mbps_wr_concurrent = 0.0
# replicate = true
size = "2252M"
storage = "local-zfs"
}
}
}
}
# VM Cloud-Init Settings
os_type = "cloud-init"
# (Optional) IP Address and Gateway
ipconfig0 = "ip=10.13.37.7/24,gw=10.13.37.1"
# (Optional) Default User
ciuser = "ubuntu"
# (Optional) Add your SSH KEY
sshkeys = <<EOF
<enter your keys here>
EOF
}
very important (but maybe known to you) is that the disk do have to follow the template config (size, storage location etc.) as closely as possible. (not sure how close is necessary..)
let me know how it goes. Best
@ynnckvdv Does your vm have a network interface?
Currently unsure if it should give a warning that no interfaces are found or if the logic should be able to find the correct interface.
Found the line causing the panic: https://github.com/Telmate/terraform-provider-proxmox/blob/3c87e4571cbf00df4f8dfe0328457f68754398f1/proxmox/resource_vm_qemu.go#L1877
@ynnckvdv would you be able to test with #1076
@zehndi77 Unfortunately, that wasn't the fix for me, but thank you
@Tinyblargon I would like to but I'm having trouble installing the plugin manually. But I indeed do not have a network adapter configured (and I do not use cloud-init), so that must be it!
When creating a new VM from an unprovisioned ISO (from scratch) using the argument
agent = 1
in theproxmox_vm_qemu
resource, the plugin breaks. Even though the VM is created, it becomes independent of Terraform andterraform destroy
will say that there is nothing to destroy.I understand that enabling the guest agent won't work in a VM where
qemu_guest_agent
isn't installed, but I don't think this is expected behaviour either?Thank you.