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

Error: The terraform-provider-maas_v1.3.1 plugin crashed! [cannot import maas_machine resource] #111

Closed
Seochokid opened this issue Oct 31, 2023 · 3 comments

Comments

@Seochokid
Copy link

Seochokid commented Oct 31, 2023

Hi,

I got this error when trying to import a maas_machine resource:

# terraform import module.prod_compute_machine[\"dc1-compute-1\"].maas_machine.machine dc1-compute-1
data.vault_kv_secret_v2.maas: Reading...
data.vault_kv_secret_v2.maas: Read complete after 0s [id=secrets/data/maas]
module.prod_compute_machine["dc1-compute-1"].maas_machine.machine: Importing from ID "dc1-compute-1"...
╷
│ Error: Plugin did not respond
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ImportResourceState call. The plugin logs may contain more details.
╵


Stack trace from the terraform-provider-maas_v1.3.1 plugin:

panic: interface conversion: interface {} is []interface {}, not string

goroutine 82 [running]:
terraform-provider-maas/maas.resourceMaasMachine.func1({0xe9bc20?, 0xc0005ca7b0?}, 0xc00059d300, {0xc11720?, 0xc000036a00})
        terraform-provider-maas/maas/resource_maas_machine.go:37 +0x550
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Provider).ImportState(0xc00009b140, {0xe9bc20, 0xc0005ca7b0}, 0xc000163620, {0xc00041ad30, 0xd})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/provider.go:388 +0x1ac
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ImportResourceState(0xc0003c1f80, {0xe9bc20?, 0xc0005ca690?}, 0xc000410b80)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1130 +0xf4
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ImportResourceState(0xc0003e2000, {0xe9bc20?, 0xc0005b5d70?}, 0xc0001347d0)
        github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:889 +0x1f6
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ImportResourceState_Handler({0xd3a400?, 0xc0003e2000}, {0xe9bc20, 0xc0005b5d70}, 0xc0000d8460, 0x0)
        github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:485 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc00019c3c0, {0xe9fc98, 0xc0004069c0}, 0xc0005c86c0, 0xc0003d2630, 0x13d28b0, 0x0)
        google.golang.org/[email protected]/server.go:1360 +0xe23
google.golang.org/grpc.(*Server).handleStream(0xc00019c3c0, {0xe9fc98, 0xc0004069c0}, 0xc0005c86c0, 0x0)
        google.golang.org/[email protected]/server.go:1737 +0xa36
google.golang.org/grpc.(*Server).serveStreams.func1.1()
        google.golang.org/[email protected]/server.go:982 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/[email protected]/server.go:980 +0x18c

Error: The terraform-provider-maas_v1.3.1 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.

The problem seems to be in the "panic: interface conversion: interface {} is []interface {}, not string" part.
Ask for help.

in main.tf

module "prod_compute_machine" {
 source          = "./modules/machine"
 
 for_each        = local.prod_compute_machines
 ...

and local.tf

 locals {
     prod_compute_machines = {
         "dc1-compute-1" = {
...

MAAS version: 3.3.3
terraform version: v1.4.1
go version: go1.21.3 linux/amd64
terraform-provider-maas: v1.3.1

Thank you.

@Seochokid Seochokid changed the title can't import maas_machine resource Error: The terraform-provider-maas_v1.3.1 plugin crashed! [cannot import maas_machine resource] Oct 31, 2023
@skatsaounis
Copy link
Collaborator

Hi @Seochokid

Thank you for opening this issue. I would like to ask you if the maas_machine for which the error is raised, has power parameters of type IPMI.

@Seochokid
Copy link
Author

Hi @Seochokid

Thank you for opening this issue. I would like to ask you if the maas_machine for which the error is raised, has power parameters of type IPMI.

Yes the maas_machine power_type where the error occurred was ipmi.

@troyanov
Copy link
Member

troyanov commented Nov 6, 2023

Hi @Seochokid
The fix for power parameters was introduced in #96
We are planning to release a new version of provider in the upcoming weeks.

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

3 participants