bpg/terraform-provider-proxmox

hostpci always gets updated to same value if set (if more than 4)

aamkye opened this issue · 2 comments

Describe the bug
A clear and concise description of what the bug is.
While having more than hostpci blocks in proxmox_virtual_environment_vm resource, anything above 4 blocks tries to update even if the same and already set (observed even on import).

To Reproduce
Steps to reproduce the behavior:

  1. Import/create VM with more than 4 hostpci blocks in proxmox_virtual_environment_vm resource.
resource "proxmox_virtual_environment_vm" "test" {
  vm_id     = 100
  node_name = "test"
  name      = "test.test"

  hostpci {
    device  = "hostpci0"
    ...
  }

  hostpci {
    device  = "hostpci1"
    ...
  }

  hostpci {
    device  = "hostpci2"
    ...
  }

  hostpci {
    device  = "hostpci3"
    ...
  }

  hostpci {
    device  = "hostpci4"
    ...
  }

  hostpci {
    device  = "hostpci5"
    ...
  }

  hostpci {
    device  = "hostpci6"
    ...
  }

  hostpci {
    device  = "hostpci7"
    ...
  }

  hostpci {
    device  = "hostpci8"
    ...
  }
}

Expected behavior
Everything applies as expected and the state is updated to corespondent state.

Screenshots
CleanShot 2024-09-18 at 23 25 51

Additional context
Add any other context about the problem here.

  • Single or clustered Proxmox: Single
  • Proxmox version: 8.2.4
  • Provider version (ideally it should be the latest version): bpg/proxmox v0.64.0
  • Terraform/OpenTofu version:
  • OS (where you run Terraform/OpenTofu from): TF 1.8.5
  • Debug logs (TF_LOG=DEBUG terraform apply):
Toggle me!

CleanShot 2024-09-18 at 23 38 18

https://pastebin.com/09jXN4R0
bpg commented

Hey @aamkye! 👋🏼

Thanks for the report. Should be relatively easy to fix.

bpg commented

Based on /usr/share/perl5/PVE/QemuServer/PCI.pm, the maximum number of hostpci devices is 16, so it will be better to fix this properly, rather than hardcoding 16 fields