bpg / terraform-provider-proxmox

Terraform / OpenTofu Provider for Proxmox VE
https://registry.terraform.io/providers/bpg/proxmox
Mozilla Public License 2.0
895 stars 140 forks source link

CD rom always gets created for new machine #1500

Closed jtamas96 closed 2 months ago

jtamas96 commented 3 months ago

Since this change: https://github.com/bpg/terraform-provider-proxmox/pull/1287/files#diff-32de2693719f6210316f28f1bde63075061724d6220adf157f96d3cb239a518cR2619

CD rom is always created for new VMs because the default value is "ide3".

Currently there is no workaround for this, because it is not allowed to give the interface an empty string value. It expects an interface plus a number, otherwise, the deployment runs into an error.

bpg commented 2 months ago

Hey @jtamas96 👋🏼

Could you pls. provide your template?

I can't reproduce this issue with a minimal config like:

resource "proxmox_virtual_environment_vm" "test_cdrom" {
  node_name = "pve"
  started   = false
  name    = "test-cdrom"
}
OpenTofu used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

OpenTofu will perform the following actions:

  # proxmox_virtual_environment_vm.test_cdrom will be created
  + resource "proxmox_virtual_environment_vm" "test_cdrom" {
      + acpi                    = true
      + bios                    = "seabios"
      + id                      = (known after apply)
      + ipv4_addresses          = (known after apply)
      + ipv6_addresses          = (known after apply)
      + keyboard_layout         = "en-us"
      + mac_addresses           = (known after apply)
      + migrate                 = false
      + name                    = "test-cdrom"
      + network_interface_names = (known after apply)
      + node_name               = "pve"
      + on_boot                 = true
      + protection              = false
      + reboot                  = false
      + scsi_hardware           = "virtio-scsi-pci"
      + started                 = false
      + stop_on_destroy         = false
      + tablet_device           = true
      + 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                   = (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.
proxmox_virtual_environment_vm.test_cdrom: Creating...
proxmox_virtual_environment_vm.test_cdrom: Creation complete after 1s [id=101]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
root@pve:~# qm config 101
acpi: 1
agent: enabled=0,fstrim_cloned_disks=0,type=virtio
arch: x86_64
balloon: 0
bios: seabios
boot: order=net0
cores: 1
cpu: cputype=qemu64
cpuunits: 1024
keyboard: en-us
memory: 512
meta: creation-qemu=9.0.2,ctime=1725833091
name: test-cdrom
numa: 0
onboot: 1
ostype: other
protection: 0
scsihw: virtio-scsi-pci
smbios1: uuid=86b0ca71-98ca-4359-b384-0de46e8a0139
sockets: 1
tablet: 1
template: 0
vga: memory=16,type=std
vmgenid: fb1fe140-25f5-4203-946e-e83b127d852f
janosi96 commented 2 months ago

Hi We are using pulumi, and it seems like the issue is only present there since the code change, so probably something strange happens there.

I will open a ticket on the pulumi provider side, and try to find out why it changed the behavior.

Thanks :)

bpg commented 2 months ago

OK, I’m going to close this as "can’t reproduce". Feel free to reopen it if you get more details or need further support.