terraform-provider-proxmox: BUG - 3.0.1-rc1: Cloning does not result in working VM - disk properties will be reset, resulting in detached disk
When running this small main.tf, the result is a VM that has the cloned disk detached (“Unused disk”) and the SCSI HW reset to LSI.
terraform {
required_providers {
proxmox = {
source = "Telmate/proxmox"
version = "=3.0.1-rc1"
}
}
}
provider "proxmox" {
pm_tls_insecure = true
pm_log_enable = true
pm_debug = true
pm_log_levels = {
_default = "debug"
_capturelog = ""
}
}
resource "proxmox_vm_qemu" "cloudinit-test" {
vmid = 4001
name = "terraform-test"
desc = "Test for cloning a VM"
target_node = "laszlo"
clone = "ubuntu-23.10-cloudinit"
full_clone = true
agent = 1
cores = 4
sockets = 1
memory = 2560
network {
bridge = "vmbr0"
firewall = false
link_down = false
macaddr = "00:ca:fe:13:37:00"
model = "virtio"
}
ssh_user = "root"
ssh_private_key = <<EOF
EOF
os_type = "cloud-init"
ipconfig0 = "ip=10.10.10.10/16,gw=10.10.0.1"
sshkeys = <<EOF
...
EOF
provisioner "remote-exec" {
inline = [
"ip a"
]
}
}
This already shows in the plan, so my guess is that this is a bug:
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# proxmox_vm_qemu.cloudinit-test will be created
+ resource "proxmox_vm_qemu" "cloudinit-test" {
+ additional_wait = 5
+ agent = 1
+ automatic_reboot = true
+ balloon = 0
+ bios = "seabios"
+ boot = (known after apply)
+ bootdisk = (known after apply)
+ clone = "ubuntu-23.10-cloudinit"
+ clone_wait = 10
+ cores = 4
+ cpu = "host"
+ default_ipv4_address = (known after apply)
+ define_connection_info = true
+ desc = "Test for cloning a VM"
+ force_create = false
+ full_clone = true
+ guest_agent_ready_timeout = 100
+ hotplug = "network,disk,usb"
+ id = (known after apply)
+ ipconfig0 = "ip=10.10.10.10/16,gw=10.10.0.1"
+ kvm = true
+ linked_vmid = (known after apply)
+ memory = 2560
+ name = "terraform-test"
+ nameserver = (known after apply)
+ onboot = false
+ oncreate = false
+ os_type = "cloud-init"
+ preprovision = true
+ reboot_required = (known after apply)
+ scsihw = "lsi"
+ searchdomain = (known after apply)
+ sockets = 1
+ ssh_host = (known after apply)
+ ssh_port = (known after apply)
+ ssh_user = "root"
+ sshkeys = <<-EOT
...
EOT
+ tablet = true
+ tags = (known after apply)
+ target_node = "laszlo"
+ unused_disk = (known after apply)
+ vcpus = 0
+ vlan = -1
+ vm_state = "running"
+ vmid = 4001
+ network {
+ bridge = "vmbr0"
+ firewall = false
+ link_down = false
+ macaddr = "00:ca:fe:13:37:00"
+ model = "virtio"
+ queues = (known after apply)
+ rate = (known after apply)
+ tag = -1
}
}
Plan: 1 to add, 0 to change, 0 to destroy.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17
It appears that:
There is no way to clone a VM successfully without having to partially repeat the disk snippet. Since this makes no sense for cloning (where the goal is to recreate an identical VM in every way, and only properties that should be changed are to be specified) and is a regression from previous releases, I would consider that a bug deserving of a fix.
For the benefit of everyone else, here’s a working minimal config (assuming that
virtio-scsi-singleis the controller type in the template VM):