ThalesGroup / terraform-provider-ciphertrust

The CipherTrust Terraform Provider allows for the incorporation of CipherTrust Cloud Key Manager functionality into a CI/CD pipeline.
Apache License 2.0
6 stars 4 forks source link

Getting 'panic: runtime error: invalid memory address or nil pointer dereference' when trying to create azure connection #4

Closed dawsonar802 closed 1 year ago

dawsonar802 commented 1 year ago

I am doing some testing and attempting to use the ciphertrust_azure_connection resource. I seem to be getting the following error each time on apply. The plan looks ok and shows it will create the connection.

Full Error:

│ Error: Request cancelled
│ 
│   with module.thales.ciphertrust_azure_connection.azure_connection,
│   on ../../../../modules/thales/main.tf line 12, in resource "ciphertrust_azure_connection" "azure_connection":
│   12: resource "ciphertrust_azure_connection" "azure_connection" {
│ 
│ The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵

Stack trace from the terraform-provider-ciphertrust_v0.9.0-beta8 plugin:

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

goroutine 24 [running]:
thales.com/terraform/terraform-provider-ciphertrust/provider.testAzureConnectionParams({0x11f0d68, 0xc000507500}, 0x1835fe0, 0x51699d?)
        thales.com/terraform/terraform-provider-ciphertrust/provider/resource_azure_connection.go:246 +0x1fa
thales.com/terraform/terraform-provider-ciphertrust/provider.resourceAzureConnectionCreateContext({0x11f0d68, 0xc000507500}, 0xc0006f2e00, {0xfb8e80?, 0x1835fe0?})
        thales.com/terraform/terraform-provider-ciphertrust/provider/resource_azure_connection.go:88 +0x86
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc0000fd0a0, {0x11f0da0, 0xc0006ed320}, 0xd?, {0xfb8e80, 0x1835fe0})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.16.0/helper/schema/resource.go:707 +0x12e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc0000fd0a0, {0x11f0da0, 0xc0006ed320}, 0xc000517520, 0xc0006f2c80, {0xfb8e80, 0x1835fe0})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.16.0/helper/schema/resource.go:837 +0xa85
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc0002bc0f0, {0x11f0cf8?, 0xc000119f40?}, 0xc0006e1860)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.16.0/helper/schema/grpc_provider.go:1021 +0xe8d
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc00030f180, {0x11f0da0?, 0xc0006ecb40?}, 0xc0006d7420)
        github.com/hashicorp/terraform-plugin-go@v0.9.0/tfprotov5/tf5server/server.go:812 +0x515
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0xfbff60?, 0xc00030f180}, {0x11f0da0, 0xc0006ecb40}, 0xc000506de0, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.9.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:385 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000256700, {0x11f48b8, 0xc000524820}, 0xc000442b40, 0xc0003ea660, 0x1826ea0, 0x0)
        google.golang.org/grpc@v1.45.0/server.go:1282 +0xccf
google.golang.org/grpc.(*Server).handleStream(0xc000256700, {0x11f48b8, 0xc000524820}, 0xc000442b40, 0x0)
        google.golang.org/grpc@v1.45.0/server.go:1619 +0xa2f
google.golang.org/grpc.(*Server).serveStreams.func1.2()
        google.golang.org/grpc@v1.45.0/server.go:921 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/grpc@v1.45.0/server.go:919 +0x28a

Error: The terraform-provider-ciphertrust_v0.9.0-beta8 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.

Operation failed: failed running terraform apply (exit 1)
dawsonar802 commented 1 year ago

This issue (for me) seems to have been related to not putting in the CM_ADDRESS, which appears to be required if not using a cluster. Once I added this, the error mentioned above has gone away. DNS Resolution is needed though it appears to the host/cm-address, which I am looking into now. Closing this issue...