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

Plugin crashes if import is attempted without API Key being set #2729

Closed
danielvaughan opened this issue Jun 10, 2021 · 0 comments · Fixed by #2735
Closed

Plugin crashes if import is attempted without API Key being set #2729

danielvaughan opened this issue Jun 10, 2021 · 0 comments · Fixed by #2735
Labels

Comments

@danielvaughan
Copy link

danielvaughan commented Jun 10, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform IBM Provider Version

Terraform v1.0.0
on darwin_amd64

  • provider registry.terraform.io/ibm-cloud/ibm v1.26.0

Affected Resource(s)

  • ibm_resource_group

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please share a link to the ZIP file.

Debug Output

terraform import ibm_resource_group.rg d9fffb9433e54d97ab2306a452a04252
ibm_resource_group.rg: Importing from ID "d9fffb9433e54d97ab2306a452a04252"...
ibm_resource_group.rg: Import prepared!
Prepared ibm_resource_group for import
ibm_resource_group.rg: Refreshing state... [id=d9fffb9433e54d97ab2306a452a04252]

│ Error: Plugin did not respond

│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ReadResource call. The plugin logs may contain more details.

Panic Output

Stack trace from the terraform-provider-ibm_v1.26.0 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x16c98bf]

goroutine 69 [running]:
github.com/IBM/platform-services-go-sdk/resourcemanagerv2.(*ResourceManagerV2).GetEnableGzipCompression(...)
github.com/IBM/[email protected]/resourcemanagerv2/resource_manager_v2.go:149
github.com/IBM/platform-services-go-sdk/resourcemanagerv2.(*ResourceManagerV2).GetResourceGroupWithContext(0x0, 0x3928c40, 0xc0001aa048, 0xc000e02730, 0xc000dd2000, 0x46d97f0, 0xc000580d80, 0x0)
github.com/IBM/[email protected]/resourcemanagerv2/resource_manager_v2.go:315 +0x27f
github.com/IBM/platform-services-go-sdk/resourcemanagerv2.(*ResourceManagerV2).GetResourceGroup(...)
github.com/IBM/[email protected]/resourcemanagerv2/resource_manager_v2.go:295
github.com/IBM-Cloud/terraform-provider-ibm/ibm.resourceIBMResourceGroupExists(0xc00092e500, 0x343ff80, 0xc000dd2000, 0x0, 0x46dbc00, 0x0)
github.com/IBM-Cloud/terraform-provider-ibm/ibm/resource_ibm_resource_group.go:242 +0x15b
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc000a4f7a0, 0x3928c08, 0xc0007261c0, 0xc000e2e150, 0x343ff80, 0xc000dd2000, 0xc0000b4208, 0x0, 0x0, 0x0)
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:604 +0x3d5
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc00000dc08, 0x3928c08, 0xc0007261c0, 0xc000726200, 0xc0007261c0, 0x100b705, 0x32c86c0)
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:575 +0x43b
github.com/hashicorp/terraform-plugin-go/tfprotov5/server.(*server).ReadResource(0xc0010814e0, 0x3928cb0, 0xc0007261c0, 0xc000e0e0c0, 0xc0010814e0, 0xc0011fe1b0, 0xc000e1cba0)
github.com/hashicorp/[email protected]/tfprotov5/server/server.go:298 +0x105
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler(0x336f8c0, 0xc0010814e0, 0x3928cb0, 0xc0011fe1b0, 0xc000e0e060, 0x0, 0x3928cb0, 0xc0011fe1b0, 0xc000e1e000, 0xde)
github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:344 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc001052000, 0x3942258, 0xc000582600, 0xc000e10000, 0xc000a9f680, 0x467bc90, 0x0, 0x0, 0x0)
google.golang.org/[email protected]/server.go:1194 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc001052000, 0x3942258, 0xc000582600, 0xc000e10000, 0x0)
google.golang.org/[email protected]/server.go:1517 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc000046230, 0xc001052000, 0x3942258, 0xc000582600, 0xc000e10000)
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-ibm_v1.26.0 plugin crashed!

Expected Behavior

Attempted to import a resource group with terraform import ibm_resource_group.rg d9fffb9433e54d97ab2306a452a04252 but no API key was set.

I would have expected an error message.

Actual Behavior

Error: Plugin did not respond message and stacktrace above

Steps to Reproduce

terraform import ibm_resource_group.rg d9fffb9433e54d97ab2306a452a04252

or assume any resource without an apikey being set

Important Factoids

Setting an apikey environment variable make the import work without error.

References

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

Successfully merging a pull request may close this issue.

2 participants