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

interface conversion: interface {} is nil, not float64 #411

Closed
pagaale opened this issue Oct 6, 2021 · 4 comments
Closed

interface conversion: interface {} is nil, not float64 #411

pagaale opened this issue Oct 6, 2021 · 4 comments

Comments

@pagaale
Copy link

pagaale commented Oct 6, 2021

Hi Team,
This is my environment:
plugin version: 2.8.0
Proxmox web UI: 6.4-13
I request a "proxmox_vm_qemu" resource with clone option in another pool, the machine is created successfully on proxmox (in the correct pool), after the plugin crashes with the error:

╷
│ Error: Plugin did not respond
│
│   with proxmox_vm_qemu.example,
│   on main.tf line 23, in resource "proxmox_vm_qemu" "example":
│   23: resource "proxmox_vm_qemu" "example" {
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵

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

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

goroutine 28 [running]:
github.com/Telmate/terraform-provider-proxmox/proxmox._resourceVmQemuRead(0xc00019d180, 0xb7cf00, 0xc0001482d0, 0xc00024acd0, 0xc000571408)
        github.com/Telmate/terraform-provider-proxmox/proxmox/resource_vm_qemu.go:1423 +0x2eb9
github.com/Telmate/terraform-provider-proxmox/proxmox.resourceVmQemuCreate(0xc00019d180, 0xb7cf00, 0xc0001482d0, 0x0, 0x0)
        github.com/Telmate/terraform-provider-proxmox/proxmox/resource_vm_qemu.go:963 +0x1ed3
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc00037a460, 0xda6e58, 0xc0003f41c0, 0xc00019d180, 0xb7cf00, 0xc0001482d0, 0x0, 0x0, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:318 +0x1ee
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc00037a460, 0xda6e58, 0xc0003f41c0, 0xc0003343f0, 0xc0004ccd40, 0xb7cf00, 0xc0001482d0, 0x0, 0x0, 0x0, ...)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:456 +0x67b
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc000304090, 0xda6e58, 0xc0003f41c0, 0xc0001494f0, 0xc0003f41c0, 0xc768e0, 0xc000302c00)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:955 +0x8ef
github.com/hashicorp/terraform-plugin-go/tfprotov5/server.(*server).ApplyResourceChange(0xc000147860, 0xda6f00, 0xc0003f41c0, 0xc000334070, 0xc000147860, 0xc000302cc0, 0xc00022fba0)
        github.com/hashicorp/[email protected]/tfprotov5/server/server.go:332 +0xb5
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0xc768e0, 0xc000147860, 0xda6f00, 0xc000302cc0, 0xc000080240, 0x0, 0xda6f00, 0xc000302cc0, 0xc00025d000, 0x7a0)
        github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:380 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc00032a380, 0xdae5b8, 0xc000103500, 0xc0003a4100, 0xc0002d8870, 0x11bbce0, 0x0, 0x0, 0x0)
        google.golang.org/[email protected]/server.go:1194 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc00032a380, 0xdae5b8, 0xc000103500, 0xc0003a4100, 0x0)
        google.golang.org/[email protected]/server.go:1517 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc000128410, 0xc00032a380, 0xdae5b8, 0xc000103500, 0xc0003a4100)
        google.golang.org/[email protected]/server.go:859 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/[email protected]/server.go:857 +0x1fd

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

from the plugin log we see the response of "GetPoolList" [resource_vm_qemu.go:1417]:
GET /api2/json/pools HTTP/1.1
{"data":[{"comment":"AGdB","poolid":"a.gdb"},{"poolid":"shared","comment":"Shared Pool"}]}
and the response of "GetPoolInfo" on "a.gdb" pool [resource_vm_qemu.go:1420]:
GET /api2/json/pools/a.gdb HTTP/1.1
[...]
{"data":{"members":[{"disk":0,"node":"node2","id":"qemu/102","uptime":5539810,"mem":2468360192,"cpu":0.0137256518047828,"status":"running","maxcpu":4,"name":"myvm","vmid":102,"maxdisk":0,"netout":2424959692,"type":"qemu","diskwrite":247920761344,"netin":9716083085,"maxmem":8589934592,"template":0,"diskread":234913370624},**{"node":"node2","disk":842927446867,"id":"storage/node2/BDLab_vm","type":"storage","maxdisk":1106271001427,"storage":"BDLab_vm","shared":1,"status":"available","plugintype":"rbd","content":"rootdir,images"},{"status":"available","shared":1,"content":"images,rootdir","plugintype":"lvm","id":"storage/node2/VM_Lun01","disk":3891248758784,"node":"node2","maxdisk":4398042316800,"storage":"VM_Lun01","type":"storage"},{"content":"backup,vztmpl,iso","plugintype":"dir","status":"available","shared":0,"type":"storage","maxdisk":35665838080,"storage":"local","id":"storage/node2/local","disk":18317074432,"node":"node2"}],"comment":"AGdB"}**}

on this test I tried with 1 vm and 3 storage in that pool, I found the same error without vms (only with storage).
I think that the plugin want to parse the "vmid" from the storage member of the pool but that element is absent.
@stoyanmarinov
Copy link

I have this problem too, using pools on Proxmox VE 7.0-11. In my case I have the template in the same pool (I granted permissions for the pool, testing if I could limit the terraform user access). The issue seems to be with the datastore being in the pool and, like you said, the plugin trying to parse vmid for storage.

@SanielDous
Copy link

For me the error also occurs in 2.9.14. Any known fixes/workarounds?

proxmox_vm_qemu.example_vm: Creating...
proxmox_vm_qemu.example_vm: Still creating... [10s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [20s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [30s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [40s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [50s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [1m0s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [1m10s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [1m20s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [1m30s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [1m40s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [1m50s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [2m0s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [2m10s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [2m20s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [2m30s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [2m40s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [2m50s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [3m0s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [3m10s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [3m20s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [3m30s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [3m40s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [3m50s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [4m0s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [4m10s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [4m20s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [4m30s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [4m40s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [4m50s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [5m0s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [5m10s elapsed]
proxmox_vm_qemu.example_vm: Still creating... [5m20s elapsed]
╷
│ Error: Plugin did not respond
│
│   with proxmox_vm_qemu.example_vm,
│   on docker.tf line 2, in resource "proxmox_vm_qemu" "example_vm":
│    2: resource "proxmox_vm_qemu" "example_vm" {
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more
│ details.
╵

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

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

goroutine 69 [running]:
github.com/Telmate/proxmox-api-go/proxmox.NewConfigQemuFromApi(0xc000092718, 0xe90f64?)
        github.com/Telmate/[email protected]/proxmox/config_qemu.go:584 +0x4605
github.com/Telmate/terraform-provider-proxmox/proxmox.resourceVmQemuCreate(0xc0001b2b80, {0xd58680?, 0xc000547130})
        github.com/Telmate/terraform-provider-proxmox/proxmox/resource_vm_qemu.go:972 +0x2c4d
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xfda800?, {0xfda800?, 0xc0003805d0?}, 0xd?, {0xd58680?, 0xc000547130?})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:695 +0x178
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc0003b87e0, {0xfda800, 0xc0003805d0}, 0xc00025cd00, 0xc0001b2a00, {0xd58680, 0xc000547130})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:837 +0xa85
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc0004c8b40, {0xfda800?, 0xc0003804b0?}, 0xc0000823c0)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1021 +0xe8d
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc0004ca0a0, {0xfda800?, 0xc0000fa390?}, 0xc000230070)
        github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:818 +0x574
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0xe5f460?, 0xc0004ca0a0}, {0xfda800, 0xc0000fa390}, 0xc000230000, 0x0)
        github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:385 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0004ee000, {0xfde3e0, 0xc000430680}, 0xc000222000, 0xc0005064e0, 0x14a0880, 0x0)
        google.golang.org/[email protected]/server.go:1336 +0xd23
google.golang.org/grpc.(*Server).handleStream(0xc0004ee000, {0xfde3e0, 0xc000430680}, 0xc000222000, 0x0)
        google.golang.org/[email protected]/server.go:1704 +0xa2f
google.golang.org/grpc.(*Server).serveStreams.func1.2()
        google.golang.org/[email protected]/server.go:965 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/[email protected]/server.go:963 +0x28a

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

@Neels-v-Wyk
Copy link

Same boat here :(

Plan: 1 to add, 0 to change, 0 to destroy.
proxmox_vm_qemu.test_server[0]: Creating...
╷
│ Error: Request cancelled
│
│   with proxmox_vm_qemu.test_server[0],
│   on main.tf line 32, in resource "proxmox_vm_qemu" "test_server":
│   32: resource "proxmox_vm_qemu" "test_server" {
│
│ The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵

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

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

goroutine 46 [running]:
github.com/Telmate/proxmox-api-go/proxmox.NewConfigQemuFromApi(0xc0000623c0, 0xc0003c76b0?)
	github.com/Telmate/[email protected]/proxmox/config_qemu.go:584 +0x4605
github.com/Telmate/terraform-provider-proxmox/proxmox.prepareDiskSize(0x0?, 0xc0002a4600?, 0x9?, 0x0?)
	github.com/Telmate/terraform-provider-proxmox/proxmox/resource_vm_qemu.go:1737 +0xeb
github.com/Telmate/terraform-provider-proxmox/proxmox.resourceVmQemuCreate(0xc000560780, {0x1767860?, 0xc0002e3450})
	github.com/Telmate/terraform-provider-proxmox/proxmox/resource_vm_qemu.go:1059 +0x1cb2
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x19d8be0?, {0x19d8be0?, 0xc00010e990?}, 0xd?, {0x1767860?, 0xc0002e3450?})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:695 +0x178
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc00033c7e0, {0x19d8be0, 0xc00010e990}, 0xc0002e9040, 0xc000560900, {0x1767860, 0xc0002e3450})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:837 +0xa85
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc0003c6b40, {0x19d8be0?, 0xc00010e4e0?}, 0xc000122320)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1021 +0xe8d
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc0001243c0, {0x19d8be0?, 0xc0000b0f30?}, 0xc0001800e0)
	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:818 +0x574
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x186d600?, 0xc0001243c0}, {0x19d8be0, 0xc0000b0f30}, 0xc000180000, 0x0)
	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:385 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0003dc000, {0x19dc840, 0xc0002ae820}, 0xc0001a6000, 0xc0003decf0, 0x1e95900, 0x0)
	google.golang.org/[email protected]/server.go:1336 +0xd23
google.golang.org/grpc.(*Server).handleStream(0xc0003dc000, {0x19dc840, 0xc0002ae820}, 0xc0001a6000, 0x0)
	google.golang.org/[email protected]/server.go:1704 +0xa2f
google.golang.org/grpc.(*Server).serveStreams.func1.2()
	google.golang.org/[email protected]/server.go:965 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
	google.golang.org/[email protected]/server.go:963 +0x28a

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.

make: *** [vms] Error 1

I've also created a gist of the debug log generated by the plugin

@Neels-v-Wyk
Copy link

Since this issue is closed, I've created a new issue to hopefully get it resolved #882

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants