Skip to content

vm: Modifying a stopped VM which's state should be started hangs on apply #2284

@TobiPeterG

Description

@TobiPeterG

Describe the bug
I noticed while testing #2260 that when a VM is stopped but should be started and I modify it (e.g. remove network devies as in this case), the apply hangs because the provider sends a "start" command to the VM (it was stopped) and immediately a "reboot" signal afterwards. This is a) not required, since the change was already applied when the VM was stopped and b) doesn't work as the VM doesn't receive the reboot signal and the apply just times out.

I think it should be detected that the VM is turned off (already known) and the reboot is not sent in this case, but only a start command.

To Reproduce
Steps to reproduce the behavior:

  1. Create a config like the one in the linked PR
  2. apply state
  3. Turn off VM in proxmox
  4. Delete network interface in opentofu config
  5. apply state
  6. See timeout and pending proxmox reboot task

Expected behavior
The reboot is not sent and the apply succeeds after starting the VM.

  • Single or clustered Proxmox:
  • Proxmox version: 9.0.10
  • Provider version (ideally it should be the latest version): 0.85.1
  • Terraform/OpenTofu version: 1.10.6
  • OS (where you run Terraform/OpenTofu from): OpenSUSE Tumbleweed

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bugSomething isn't workingpriority:P2Medium priority

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions