bpg / terraform-provider-proxmox

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

VM listing operations fail when node is offline #692

Open xevz opened 8 months ago

xevz commented 8 months ago

Describe the bug

If one or more nodes are offline in the cluster, VM listing operations such as the proxmox_virtual_environment_vms data source or state refreshing fails as the /nodes/<node>/ endpoint is used.

To Reproduce

  1. Set up multi node cluster.
  2. Create multiple proxmox_virtual_environment_vm resources in the cluster, on multiple nodes
  3. Shut off one of the nodes
  4. Run configuration with proxmox_virtual_environment_vms data source
  5. See error

    Planning failed. Terraform encountered an error while generating this plan.
    
    ╷
    │ Error: error retrieving VMs: received an HTTP 595 response - Reason: No route to host
    │
    │   with module.templates.data.proxmox_virtual_environment_vms.all_vms,
    │   on .terraform/modules/templates/main.tf line 1, in data "proxmox_virtual_environment_vms" "all_vms":
    │    1: data "proxmox_virtual_environment_vms" "all_vms" {}
    │
    ╵

Expected behavior

VMs on the offline node to be listed, but as "shutdown"/"offline" state, and ignored for further operations.

Additional context

The GUI seems to use the /cluster/resources API endpoint, rather than iterating over /nodes/<node>, which successfully list all VMs in the cluster without having all nodes running.

bpg-autobot[bot] commented 1 month ago

Marking this issue as stale due to inactivity in the past 180 days. This helps us focus on the active issues. If this issue is reproducible with the latest version of the provider, please comment. If this issue receives no comments in the next 30 days it will automatically be closed. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!