gerardlemetayerc / terraform-provider-device42

MIT License
1 stars 1 forks source link

Resource IP creation - "Error: Plugin did not respond" when permission not OK #55

Closed gerardlemetayerc closed 11 months ago

gerardlemetayerc commented 11 months ago

Description

When permission is deny on resource on Device42 side, following issue occured :

Issue

 Error: Plugin did not respond   with module.vm-linux[0].device42_ip.ip,   on .terraform/modules/vm-linux/resource_device42.tf line 1, in resource "device42_ip" "ip":    1: resource "device42_ip" "ip" { 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-device42_1.3.2_linux_amd64 plugin: panic: runtime error: index out of range [1] with length 0 goroutine 37 [running]:github.com/gerardlemetayerc/provider-terraform-device42/device42.resourceDevice42IpCreate(0x0?, {0xc67560?, 0xc0000365a0})    C:/Users/xxx/repos/terraform-provider-device42/device42/resource_ip.go:128 
+0x828github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xdbc6e0?, {0xdbc6e0?, 0xc000497140?}, 0xd?, {0xc67560?, 0xc0000365a0?})    C:/Users/xxx/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.26.1/helper/schema/resource.go:695 +0x178github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc000342540, {0xdbc6e0, 0xc000497140}, 0xc0004a8820, 0xc00049c880, {0xc67560, 0xc0000365a0})    C:/Users/xxx/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.26.1/helper/schema/resource.go:837 +0xa85github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc0003ccb58, {0xdbc6e0?, 0xc000496b40?}, 0xc00048c370)    
C:/Users/xxx/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.26.1/helper/schema/grpc_provider.go:1021 +0xe8dgithub.com/hashicorp/terraform-plugin-go/xxxxx/tf5server.(*server).ApplyResourceChange(0xc00029a3c0, {0xdbc6e0?, 0xc000496150?}, 0xc000478230)    C:/Users/xxx/go/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.14.3/tfprotov5/tf5server/server.go:818 +0x574github.com/hashicorp/terraform-plugin-go/xxxxx/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0xc42380?, 0xc00029a3c0}, {0xdbc6e0, 0xc000496150}, 0xc0004780e0, 0x0)    C:/Users/xxx/go/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.14.3/xxxxx/internal/tfplugin5/tfplugin5_grpc.pb.go:385 +0x170google.golang.org/grpc.(*Server).processUnaryRPC(0xc0003e6000, {0xdc0200, 0xc0001ab380}, 0xc0002be000, 0xc0003e85d0, 0x1275ac0, 0x0)    C:/Users/xxx/go/pkg/mod/google.golang.org/grpc@v1.56.2/server.go:1337 +0xdf0google.golang.org/grpc.(*Server).handleStream(0xc0003e6000, {0xdc0200, 0xc0001ab380}, 0xc0002be000, 0x0)    C:/Users/xxx/go/pkg/mod/google.golang.org/grpc@v1.56.2/server.go:1714 +0xa2fgoogle.golang.org/grpc.(*Server).serveStreams.func1.1()    C:/Users/xxx/go/pkg/mod/google.golang.org/grpc@v1.56.2/server.go:959 +0x98created by google.golang.org/grpc.(*Server).serveStreams.func1    C:/Users/xxx/go/pkg/mod/google.golang.org/grpc@v1.56.2/server.go:957 +0x18c Error: The terraform-provider-device42_1.3.2_linux_amd64 plugin crashed! This is always indicative of a bug within the plugin. It would be immenselyhelpful if you could report the crash with the plugin's maintainers so that itcan be fixed. The output above should help diagnose the issue. time=2023-07-28T18:33:32+02:00 level=error msg=Terraform invocation failed in /home/xxx/terraform/2023-07-28_18H33_xxx_549ca08387time=2023-07-28T18:33:32+02:00 level=error msg=1 error occurred:    * [/home/xxx/terraform/2023-07-28_18H33_xxx_549ca08387] exit status 1
gerardlemetayerc commented 11 months ago

Workaround identified on impacted code lines.