bpg / terraform-provider-proxmox

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

Provider returns modification complete on disk shrinking operation but doesn't shrink the disk #1560

Closed weiss-m closed 1 month ago

weiss-m commented 1 month ago

Describe the bug The provider doesn't deny shrinking of disks. I changed disk size from 20 GiB to 10 GiB and run tofu apply. I get back Modifications complete after 4s. Also, the instances were rebooted without any warning. If I connect to the vm, I can see that disk size is still 20GiB. If I run tofu plan, it's still trying to change disk size from 20 GiB to 10 GiB.

OpenTofu used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

OpenTofu will perform the following actions:

  # module.proxmox_staging[0].proxmox_virtual_environment_vm.server will be updated in-place
  ~ resource "proxmox_virtual_environment_vm" "server" {
        id                      = "61950"
        # (28 unchanged attributes hidden)

      ~ disk {
          ~ size              = 20 -> 10
            # (11 unchanged attributes hidden)
        }

        # (9 unchanged blocks hidden)
    }

  # module.proxmox_staging[1].proxmox_virtual_environment_vm.server will be updated in-place
  ~ resource "proxmox_virtual_environment_vm" "server" {
        id                      = "61951"
        # (28 unchanged attributes hidden)

      ~ disk {
          ~ size              = 20 -> 10
            # (11 unchanged attributes hidden)
        }

        # (9 unchanged blocks hidden)
    }

Plan: 0 to add, 2 to change, 0 to destroy.

Do you want to perform these actions?
  OpenTofu will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

module.proxmox_staging[1].proxmox_virtual_environment_vm.server: Modifying... [id=61951]
module.proxmox_staging[0].proxmox_virtual_environment_vm.server: Modifying... [id=61950]
module.proxmox_staging[0].proxmox_virtual_environment_vm.server: Modifications complete after 4s [id=61950]
module.proxmox_staging[1].proxmox_virtual_environment_vm.server: Modifications complete after 4s [id=61951]

Expected behavior Disk shall be shrinked or shrinking of disks shall be denied if not possible.

bpg commented 1 month ago

Should be fixed in #1580