Skip to content

proxmox_virtual_environment_vm can't manage VMs with ISOs #2550

Description

@easontm

Describe the bug
I adopted (state import) a VM I have that was created with an ISO as installation media (in my case, a Talos ISO). When trying to align the Terraform code with the remote state (plan -> edit -> repeat until no diff), I set a disk block to include this ISO as described by the Terraform state.

    disk {
        cache             = "none"
        datastore_id      = "my-datastore"
        file_format       = "iso"
        interface         = "ide2"
        path_in_datastore = "iso/nocloud-amd64.iso"
    }

However, this setting the disk to an iso is forbidden

Error: expected file_format to be one of ["qcow2" "raw" "vmdk"], got iso

To Reproduce
Steps to reproduce the behavior:

  1. Create a VM with ISO boot media using the Proxmox UI
  2. Create a stub proxmox_virtual_environment_vm resource with the correct VM ID (ex. 100).
  3. Run import, e.g. terraform import proxmox_virtual_environment_vm.my_vm my_node/100
  4. Run plan and update code to reduce diff (alternatively, have terraform show the state then just copy it)
  5. See error

Here is a copy of my tg state show which has been cleaned to remove non-settable attributes

resource "proxmox_virtual_environment_vm" "talos_prototype_node" {
    acpi                                 = true
    bios                                 = "seabios"
    boot_order                           = [
        "scsi0",
        "ide2",
        "net0",
    ]
    delete_unreferenced_disks_on_destroy = true
    mac_addresses                        = []
    migrate                              = false
    name                                 = "talos-prototype-1"
    node_name                            = "pve1"
    on_boot                              = false
    protection                           = false
    purge_on_destroy                     = true
    reboot                               = false
    reboot_after_update                  = true
    scsi_hardware                        = "virtio-scsi-pci"
    started                              = true
    stop_on_destroy                      = false
    tablet_device                        = true
    tags                                 = []
    template                             = false
    timeout_clone                        = 1800
    timeout_create                       = 1800
    timeout_migrate                      = 1800
    timeout_move_disk                    = 1800
    timeout_reboot                       = 1800
    timeout_shutdown_vm                  = 1800
    timeout_start_vm                     = 1800
    timeout_stop_vm                      = 300
    vm_id                                = 820

    agent {
        enabled = true
        timeout = "15m"
        trim    = false
    }

    cpu {
        cores      = 2
        flags      = []
        hotplugged = 0
        limit      = 0
        numa       = false
        sockets    = 1
        type       = "x86-64-v2-AES"
    }

    disk {
        aio               = "io_uring"
        backup            = true
        cache             = "none"
        datastore_id      = "pve-shared"
        discard           = "ignore"
        file_format       = "iso"
        interface         = "ide2"
        iothread          = false
        path_in_datastore = "iso/nocloud-amd64.iso"
        replicate         = true
        ssd               = false
    }
    disk {
        aio               = "io_uring"
        backup            = true
        cache             = "none"
        datastore_id      = "local-lvm"
        discard           = "ignore"
        file_format       = "raw"
        interface         = "scsi0"
        iothread          = false
        path_in_datastore = "vm-820-disk-0"
        replicate         = true
        size              = 32
        ssd               = false
    }

    memory {
        dedicated      = 2048
        floating       = 0
        keep_hugepages = false
        shared         = 0
    }

    network_device {
        bridge       = "vmbr0"
        disconnected = false
        enabled      = true
        firewall     = true
        mac_address  = "BC:24:11:F7:F8:34"
        model        = "virtio"
        mtu          = 0
        queues       = 0
        rate_limit   = 0
        vlan_id      = 0
    }

    operating_system {
        type = "l26"
    }
}

and the output of terraform|tofu apply.

Error: expected file_format to be one of ["qcow2" "raw" "vmdk"], got iso

Expected behavior
Non-read-only attributes can be set to all values that their state shows.

  • Single or clustered Proxmox: clustered
  • Proxmox version: 9.1.1
  • Provider version (ideally it should be the latest version): 0.94.0
  • Terraform/OpenTofu version: OpenTofu v1.11.4
  • OS (where you run Terraform/OpenTofu from): macOS Tahoe 26.2
  • Debug logs (TF_LOG=DEBUG terraform apply):

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions