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

Adding/removing hostpci devices forces vm recreation #503

Closed
michaelze opened this issue Aug 18, 2023 · 0 comments · Fixed by #504
Closed

Adding/removing hostpci devices forces vm recreation #503

michaelze opened this issue Aug 18, 2023 · 0 comments · Fixed by #504
Labels
🐛 bug Something isn't working

Comments

@michaelze
Copy link
Contributor

When adding or removing a hostpci argument to a vm resource, the vm is forced to be recreated. This should not happen, since adding/removing hostpci devices via the ui is possible. Although, it seems that a reboot would be required.

To Reproduce
Steps to reproduce the behavior:

  1. Create a resource vm without a hostpci device
  2. Run terraform apply
  3. VM is created correctly with the device attached
  4. Modify the resource, remove the hostpci device
  5. Run terraform apply
  6. See the vm being recreated

The same can be witnessed, when creating a vm with a hostpci device and then later remove it.

The following resource can be used in order to reproduce the issue:

resource "proxmox_virtual_environment_vm" "recreate_when_hostpci_changes" {
  name        = "recreate-when-hostpci-changes"
  description = "## TEST recreate-when-hostpci-changes"

  node_name = "foo"

  started = false

  cpu {
    cores = 1
  }

  memory {
    dedicated = 512
  }

  operating_system {
    type = "l26"
  }

  network_device {
    bridge = "vmbr0"
  }

  hostpci {
    device = "hostpci0"
    id = "81:00.8"
    rombar = true
  }
}

Expected behavior
Adding/removing hostpci devices to/from a vm should not force recreation of the vm.

Additional context
Provider version: Tested with 0.29.0 but the problem was present since the introduction of the hostpci argument
Terraform version: v1.5.1
OS: Running from wsl on Windows 10

I'll be trying to come up with a pull request.

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
1 participant