Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disk speed always gets updated to same value if set to all zeros #1539

Closed
mater-345 opened this issue Sep 17, 2024 · 1 comment
Closed

Disk speed always gets updated to same value if set to all zeros #1539

mater-345 opened this issue Sep 17, 2024 · 1 comment
Labels
🐛 bug Something isn't working
Milestone

Comments

@mater-345
Copy link

Hi,

Describe the bug
After setting the disk speed to 0 (unlimited), rerun always wants to set the same 0 value again for the VM.

To Reproduce
Steps to reproduce the behavior:

  1. Create a resource
resource "proxmox_virtual_environment_vm" "vm-disk-speed-tester" {
  bios          = "seabios"
  vm_id         = "606"
  name          = "vm-disk-speed-tester"
  scsi_hardware = "virtio-scsi-pci"
  node_name     = "proxmox01"
  timeout_clone = 180
  timeout_create = 180
  timeout_migrate = 180
  timeout_reboot = 180
  timeout_shutdown_vm = 180
  timeout_start_vm = 180
  timeout_stop_vm = 180

  agent {
    enabled = "true"
    timeout = "3m"
  }
  cpu {
    cores   = 4
    sockets = 1
    type    = "qemu64"
  }

  disk {
    datastore_id = "ceph-ha"
    interface    = "scsi0"
    file_format  = "raw"
    size         = 52
    cache        = "writeback"
    discard      = "on"
    speed {
      iops_read            = 0
      iops_read_burstable  = 0
      iops_write           = 0
      iops_write_burstable = 0 
      read                 = 0
      read_burstable       = 0
      write                = 0
      write_burstable      = 0
    }
  }
...
  1. Run terraform apply after the VM created:
  2. Runterraform apply again:
proxmox_virtual_environment_vm.vm-disk-speed-tester: Refreshing state... [id=606]

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

Terraform will perform the following actions:

  # proxmox_virtual_environment_vm.vm-disk-speed-tester will be updated in-place
  ~ resource "proxmox_virtual_environment_vm" "vm-disk-speed-tester" {
        id                      = "606"
        name                    = "vm-disk-speed-tester"
        # (26 unchanged attributes hidden)

      ~ disk {
          ~ discard           = "ignore" -> "on"
          ~ iothread          = true -> false
            # (12 unchanged attributes hidden)

          + speed {
              + iops_read            = 0
              + iops_read_burstable  = 0
              + iops_write           = 0
              + iops_write_burstable = 0
              + read                 = 0
              + read_burstable       = 0
              + write                = 0
              + write_burstable      = 0
            }
        }

Expected behavior
Terraform should not try to change 0 value with a 0 value.

If the speed settings are on their default values, terraform doesn't want to change these values.

  • Single or clustered Proxmox: Clustered Proxmox
  • Proxmox version: 8.2.4
  • Provider version (ideally it should be the latest version): latest 0.64.0
  • Terraform/OpenTofu version: v1.9.5-1
  • Debug logs (TF_LOG=DEBUG terraform apply):
@mater-345 mater-345 added the 🐛 bug Something isn't working label Sep 17, 2024
@bpg bpg changed the title Disk speed always gets updated to same value if set Disk speed always gets updated to same value if set to all zeros Sep 21, 2024
@bpg
Copy link
Owner

bpg commented Sep 21, 2024

Hi @mater-345! 👋🏼

If the speed block contains all zeros (i.e., its default value), it is treated as undefined. In other words, the provider can't distinguish between two configurations: one with a speed block set to all zeros, and another without a speed block. This means no remote configuration changes related to this block are applied to the remote VM, and nothing corresponding to this block is read back, making it inconsequential and thus removed from the state.

This behavior is not ideal, but it would be difficult to change in the current implementation. In #1231, we'll have more flexibility in managing the current state and defaults, so this use case could be handled differently in the future. However, for now, the provider can't properly support it.

I'm going to close it as "won't do" for 0.x, and we'll check this case in the future 1.x.

@bpg bpg closed this as not planned Won't fix, can't repro, duplicate, stale Sep 21, 2024
@bpg bpg added this to the v1.0 milestone Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants