Telmate / terraform-provider-proxmox

Terraform provider plugin for proxmox
MIT License
2.19k stars 531 forks source link

Support for Passthrough Physical Disk to a VM #855

Closed zmingxie closed 9 months ago

zmingxie commented 1 year ago

I followed this guide and attached a physical disk to the OpenMediaVault VM on Proxmox: https://pve.proxmox.com/wiki/Passthrough_Physical_Disk_to_Virtual_Machine_(VM)

After doing that, terraform crashes on refreshing the state:

terraform plan -var-file=./credentials.tfvars

proxmox_lxc.tailscale: Refreshing state... [id=proxmox/lxc/500]
proxmox_vm_qemu.pi_hole: Refreshing state... [id=proxmox/qemu/201]
proxmox_vm_qemu.omv: Refreshing state... [id=proxmox/qemu/202]

Planning failed. Terraform encountered an error while generating this plan.

╷
│ Error: Request cancelled
│
│   with proxmox_vm_qemu.omv,
│   on omv.tf line 3, in resource "proxmox_vm_qemu" "omv":
│    3: resource "proxmox_vm_qemu" "omv" {
│
│ The plugin.(*GRPCProvider).ReadResource request was cancelled.
╵
╷
│ Error: Request cancelled
│
│   with proxmox_vm_qemu.pi_hole,
│   on pi_hole.tf line 3, in resource "proxmox_vm_qemu" "pi_hole":
│    3: resource "proxmox_vm_qemu" "pi_hole" {
│
│ The plugin.(*GRPCProvider).ReadResource request was cancelled.
╵

Stack trace from the terraform-provider-proxmox_v2.9.14 plugin:

panic: interface conversion: interface {} is nil, not string

goroutine 58 [running]:
github.com/Telmate/terraform-provider-proxmox/proxmox._resourceVmQemuRead(0x14000094300, {0x10351dee0?, 0x14000231220})
    github.com/Telmate/terraform-provider-proxmox/proxmox/resource_vm_qemu.go:1586 +0x2b5c
github.com/Telmate/terraform-provider-proxmox/proxmox.resourceVmQemuRead(0x0?, {0x10351dee0?, 0x14000231220?})
    github.com/Telmate/terraform-provider-proxmox/proxmox/resource_vm_qemu.go:1446 +0x24
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0x10365a9a0?, {0x10365a9a0?, 0x140002f8990?}, 0xd?, {0x10351dee0?, 0x14000231220?})
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.25.0/helper/schema/resource.go:712 +0x134
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0x140003b67e0, {0x10365a9a0, 0x140002f8990}, 0x140007ae8f0, {0x10351dee0, 0x14000231220})
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.25.0/helper/schema/resource.go:1015 +0x468
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0x14000440b70, {0x10365a9a0?, 0x140002f8840?}, 0x1400020c6c0)
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.25.0/helper/schema/grpc_provider.go:613 +0x400
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadResource(0x14000126460, {0x10365a9a0?, 0x140002f8000?}, 0x1400016e240)
    github.com/hashicorp/terraform-plugin-go@v0.14.3/tfprotov5/tf5server/server.go:748 +0x3e8
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0x103623a60?, 0x14000126460}, {0x10365a9a0, 0x140002f8000}, 0x140001f0000, 0x0)
    github.com/hashicorp/terraform-plugin-go@v0.14.3/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:349 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0x1400045a000, {0x10365e540, 0x1400035a000}, 0x140000e5680, 0x14000458d50, 0x103afb830, 0x0)
    google.golang.org/grpc@v1.53.0/server.go:1336 +0xb7c
google.golang.org/grpc.(*Server).handleStream(0x1400045a000, {0x10365e540, 0x1400035a000}, 0x140000e5680, 0x0)
    google.golang.org/grpc@v1.53.0/server.go:1704 +0x82c
google.golang.org/grpc.(*Server).serveStreams.func1.2()
    google.golang.org/grpc@v1.53.0/server.go:965 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func1
    google.golang.org/grpc@v1.53.0/server.go:963 +0x290

Error: The terraform-provider-proxmox_v2.9.14 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

Looking at the code and the doc, it seems this provider doesn't support attaching raw disk: https://github.com/Telmate/terraform-provider-proxmox/blob/v2.9.14/proxmox/resource_vm_qemu.go#L1581-L1600

Doc: https://registry.terraform.io/providers/Telmate/proxmox/latest/docs/resources/vm_qemu#disk-block

Has anyone tried this? Any workaround suggestions?

Aksogen commented 12 months ago

@Telmate, Hello! When will this be fixed\released?

github-actions[bot] commented 10 months ago

This issue is stale because it has been open for 60 days with no activity. Please update the provider to the latest version and, in the issue persist, provide full configuration and debug logs

github-actions[bot] commented 9 months ago

This issue was closed because it has been inactive for 5 days since being marked as stale.