Multiple disks created when cloning VM template with Terraform

obsolete

New Member
Mar 23, 2021
21
2
3
56
I am using Terraform to clone a Server 2019 VM template which will be used as a Windows Event Forwarded (wef). The Terraform code looks like this:

Code:
# Create the wef VM
resource "proxmox_vm_qemu" "wef" {

  name        = "wef"
  target_node = "pve-node1"
  tags        = "test"

  # Clone from windows 2k19-cloudinit template
  clone = "win-2k19-cloudinit"
  os_type = "cloud-init"
  
# Cloud init options
  cicustom = "user=local:snippets/user_data_wef.yml"
  cloudinit_cdrom_storage = "local"
 
  ipconfig0 = "ip=dhcp"
  ipconfig1 = "ip=dhcp"

  memory       = 4096
  agent        = 1
  sockets      = 1
  cores        = 2

  # Set the boot disk paramters
  bootdisk     = "scsi0"
  scsihw       = "virtio-scsi-pci"
  disk {
    size            = "32G"
    type            = "scsi"
    storage         = "ceph-vm"
  } # end disk

  # Set the network
  network {
    model = "virtio"
    bridge = "vmbr0"
  } # end first network block

  network {
    model = "virtio"
    bridge = "vmbr1"
    macaddr = "00:01:42:12:84:13"
  } # end second network block

  # Ignore changes to the network
  ## MAC address is generated on every apply, causing
  ## TF to think this needs to be rebuilt on every apply
  lifecycle {
     ignore_changes = [
       network
     ]
  } # end lifecycle
} # end proxmox_vm_qemu wef resource declaration

For reference, the VM template has only one disk configured and attached:
1634588960424.png

But, after Terraform runs and clones the VM, I get a virtio and scsi disk:
1634589025852.png

This strikes me as odd because I also clone a Windows 10 VM using the same exact Terraform code style and VM configuration and get the correct number of disks.
 
disk {
size = "32G"
type = "scsi"
storage = "ceph-vm"
} # end disk
my guess is that snippet for the disk..

cloning the template also clones the disk already (virtio0) but you add one at 'scsi' in your snippet