terraform-provider-proxmox: [3.0.1-rc2] Error refresh state USB passthrough device

Hi, migrates from 3.0.1-rc1 to 3.0.1-rc2 and fix error with USB passthrough device.

Proxmox VE cluster with version nodes: 8.0.4 and 8.2.2 Terraform - 1.8.4

USB manually config in VM by root and fix in .tfstate by terraform refresh. Ignore changes in state VM from provider by this:

  lifecycle {
    ignore_changes = [
      usb
    ]
  }

In new version 3.0.1-rc2 error by terraform refresh or terraform plan:

│ Error: Invalid address to set: []string{"usb", "0", "id"}
│ 
│   with proxmox_vm_qemu._101_xxx,
│   on 101_xxx.tf line 3, in resource "proxmox_vm_qemu" "_101_xxx":
│    3: resource "proxmox_vm_qemu" "_101_xxx" {

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 19 (5 by maintainers)

Commits related to this issue

Most upvoted comments

Currently working on a fix. It will also ad support for mapped USB devices, so it will be feature complete with the PVE 8.2 GUI.

Hello. After updating from version 3.0.1-rc1 to version 3.0.1-rc3, I encountered the same error for VMs to which I added PCI-e device mapping. How can I add an ignore rule for devices that I added myself?

I tried this one:

  lifecycle {
    ignore_changes = [
      hostpci,
    ]
  }

But the error is stilling.

Try this ignore_changes:

...
    ignore_changes = [
      usb[0]
    ]
...

or

...
    ignore_changes = [
      usb[0].host
      usb[0].usb3
    ]
...

Hi! Thank you! Unfortunately this didn’t help.

@lucian-tx fixed a similar issue for the hostpci config. I applied the same path to usb devices in #1077, which fixes this issue for me.

  1. you can use both variants: example of working dynamic block (network)
    dynamic network {
        for_each = var.vm_network_interfaces
        content {
            bridge   = network.value.bridge
            model    = network.value.model
            firewall = network.value.firewall
            tag      = network.value.vlan        
        }
    }
  1. So…it worked before, and it didn’t say in the change notes that it no longer works 😐 hostpci block was added in v2.9.14 (How to enable PCI passthrough #299)

(anyway it present in

https://github.com/Telmate/terraform-provider-proxmox/blob/d3fed178e06e9429e27e92094387e1ceef95e825/proxmox/resource_vm_qemu.go#L437

)

  1. OK, but there is no official documentation that this can be done un such way…

  2. Latest major version is v3, not v2 Present - doesn’t mean that it really works 😃 and at the same time there is no documentation for this… Here it is necessary to get comments from the developers.