badarsebard / terraform-provider-xsoar

Apache License 2.0
9 stars 3 forks source link

Plugin panics when attempt to find an account that doesn't exist #4

Closed jrauen closed 1 year ago

jrauen commented 2 years ago

If an account was previously created by Terraform and then subsequently removed manually from the XSOAR deployment then when the plugin goes to refresh the state it throws the following error:

Stack trace from the terraform-provider-xsoar_v0.3.19 plugin:

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

goroutine 88 [running]:
terraform-provider-xsoar/xsoar.resourceAccount.Read({{0x90, 0xc00000dc68, 0xc000115e40}}, {0x10d5268, 0xc00047d100}, {{{{0x10e13a0, 0xc000674090}, {0xdfe420, 0xc00066d0e0}}, {0xc00066ccc0, ...}}, ...}, ...)
terraform-provider-xsoar/xsoar/resource_account.go:288 +0xc25
github.com/hashicorp/terraform-plugin-framework/tfsdk.(*server).readResource(0xc000182690, {0x10d5268, 0xc00047d100}, 0xc00047d0c0, 0xc00040fad8)
github.com/hashicorp/terraform-plugin-framework@v0.4.2/tfsdk/serve.go:571 +0x87b
github.com/hashicorp/terraform-plugin-framework/tfsdk.(*server).ReadResource(0xc0000468c0, {0x10d5268, 0xc00047d080}, 0xc000101b60)
github.com/hashicorp/terraform-plugin-framework@v0.4.2/tfsdk/serve.go:506 +0x92
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ReadResource(0xc0000468c0, {0x10d5310, 0xc00066c9c0}, 0xc00056c780)
github.com/hashicorp/terraform-plugin-go@v0.4.0/tfprotov6/tf6server/server.go:297 +0x1fb
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ReadResource_Handler({0xede9a0, 0xc0000468c0}, {0x10d5310, 0xc00066c9c0}, 0xc00056c720, 0x0)
github.com/hashicorp/terraform-plugin-go@v0.4.0/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:345 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001a4700, {0x10e4c40, 0xc00020a000}, 0xc000576200, 0xc000182720, 0x182cfb0, 0x0)
google.golang.org/grpc@v1.32.0/server.go:1194 +0xc8f
google.golang.org/grpc.(*Server).handleStream(0xc0001a4700, {0x10e4c40, 0xc00020a000}, 0xc000576200, 0x0)
google.golang.org/grpc@v1.32.0/server.go:1517 +0xa2a
google.golang.org/grpc.(*Server).serveStreams.func1.2()
google.golang.org/grpc@v1.32.0/server.go:859 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
google.golang.org/grpc@v1.32.0/server.go:857 +0x294

Error: The terraform-provider-xsoar_v0.3.19 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.

This looks to be an issue with how the plugin is parsing the response from the XSOAR API and performing an unsafe type conversion.

badarsebard commented 1 year ago

fixed in v0.3.24