-2

I created the following Template in Proxmox: enter image description here Here is my Terraform file to create a VM:

resource "proxmox_vm_qemu" "fuse-pri" {
  name        = "fuse-pri"
  vmid        = "302"
  desc        = "Primary Fuse PostgreSQL DB - built by terraform"
  target_node = "pve"

  # VM Advanced General Settings
  onboot = true

  ### Clone (template name)
  clone      = var.rocky_vm_template
  full_clone = true

  # VM System Settings (important for QEMU agent). 
  # Because in my template I didn't install QEMU agent, I have to set it to "0"
  agent = 0

  # VM CPU Settings
  cores   = 8
  sockets = 1
  cpu     = "host"
  numa    = true

  # VM RAM Settings
  memory  = 16384
  balloon = 0

  # VM Network Settings
  network {
    bridge = "vmbr1" # on pfSense LAN 
    model  = "virtio"
    tag    = 10
  }

  # VM Cloud-Init Settings
  os_type = "cloud-init"

  scsihw = "virtio-scsi-single"
  bootdisk = "scsi0"
  disk {
    # slot = 0
    # set disk size here. leave it small for testing because expanding the disk takes time.
    size     = "100G"
    type     = "scsi"
    storage  = "supersonic"
    iothread = 1
    discard  = "on"
    ssd      = 1
    backup   = true
  }
}

It changes the Cloud-Init CD-ROM instead of the Other drive (scsi1). How do I make it change the storage for the scsi1 drive instead of the default Cloud-Init scsi0?

Thanks

Shery
  • 1,808
  • 5
  • 27
  • 51

1 Answers1

1

I was able to fix it using the following:

# The first disk will be automatically created as scsi0 and the second will be created as scsi1. 
  # My scsi0 is the cloud-init drive so I am not changing anything and type, storage and size is required args.
  disk {
    # set disk size here. For more params:https://registry.terraform.io/providers/Telmate/proxmox/latest/docs/resources/vm_qemu
    type    = "scsi"
    storage = "supersonic"
    size    = "4M"
    media   = "cdrom"
  }

  # This is actual disk which will be cloned from template and then resized. 
  disk {
    # set disk size here. For more params:https://registry.terraform.io/providers/Telmate/proxmox/latest/docs/resources/vm_qemu
    size     = "100G"
    type     = "scsi"
    storage  = "supersonic"
    iothread = 1
    discard  = "on"
    ssd      = 1
    backup   = true
  }
Shery
  • 1,808
  • 5
  • 27
  • 51