bpg / terraform-provider-proxmox

Terraform Provider for Proxmox
https://registry.terraform.io/providers/bpg/proxmox
Mozilla Public License 2.0
659 stars 114 forks source link

Allow to change resource pool for VM / container without re-creating the resource #693

Open Anfer410 opened 8 months ago

Anfer410 commented 8 months ago

Describe the bug When trying to change/add pool id to existing container it forces replacement

To Reproduce Steps to reproduce the behavior:

  1. Create a proxmox_virtual_environment_container
  2. Update pool_id value
  3. See error "proxmox_virtual_environment_container.alpine_container must be replaced"

Please also provide a minimal Terraform configuration that reproduces the issue. registry.terraform.io/bpg/proxmox { version = "0.37.0" constraints = "0.37.0" } "terraform_version": "1.6.3",

Expected behavior Pool id modifications shouldn't force replacement

bpg commented 7 months ago

Thanks for report, @Anfer410!

The PVE does not allow to change the pool ID on VM / container level after creation. I.e. when you create a container you can assign it to a pool. But in order to change the assignment, or to assign to a pool after creation, you have to go through the pool management on datacenter level, not the VM / container on a PVE node:

Screenshot 2023-11-07 at 9 12 31 PM

The API is structured in the same way, so provider can specify a pool at creation time, but can't update it when the VM / container resource is updated. Instead, we can use proxmox_virtual_environment_pool resource for pool management. However, the update command for this resource is not fully implemented -- it allows only to update a comment, but not members :(

Hope this makes sense. I'm going to re-classify the ticket as "enhancement" then.