Telmate / terraform-provider-proxmox

Terraform provider plugin for proxmox
MIT License
2.21k stars 533 forks source link

apply tries always set format raw for cloud init disk #1124

Open nrukavkov opened 1 month ago

nrukavkov commented 1 month ago

terraform provider: v3.0.1-rc4 proxmox: 8.2.2

I wrote a module like hist

....

disk {
    type    = "cloudinit"
    slot    = "ide0"
    storage = "local"
    backup = false
  }

  dynamic "disk" {
    for_each = var.vm_disk
    content {
      type       = disk.value.type
      storage    = disk.value.storage
      size       = disk.value.size
      format     = disk.value.format
      slot       = disk.value.slot
      emulatessd = disk.value.emulatessd
    }
  }

....

It creates VM but after apply again it tries to set format disk to format raw

Terraform will perform the following actions:

  # proxmox_vm_qemu.this will be updated in-place
  ~ resource "proxmox_vm_qemu" "this" {
        id                     = "server242/qemu/106"
        name                   = "linux-demo999.prod"
        tags                   = "app;demo;spb-5"
        # (37 unchanged attributes hidden)

      ~ disk {
          + format               = "raw"
            id                   = 0
            # (21 unchanged attributes hidden)
        }

        # (4 unchanged blocks hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.
wontfixthis commented 1 month ago

same here

nrukavkov commented 1 month ago

workaround

 # Setup the disk
  disks {
    ide {
      ide0 {
        cloudinit {
          # storage = var.main_disk_storage
          storage = "local"
        }
      }
    }
    scsi {
      dynamic "scsi0" {
        for_each = var.vm_disk
        content {
          disk {
            size       = scsi0.value.size
            storage    = scsi0.value.storage
            format     = scsi0.value.format
            emulatessd = scsi0.value.emulatessd
          }
        }
      }
    }
  }