vmware / terraform-provider-tanzu-mission-control

Terraform provider to manage resources of Tanzu Mission Control
Mozilla Public License 2.0
37 stars 31 forks source link

Provider crashing on access to the Tanzu Mission Control #85

Closed joelcomp1 closed 1 year ago

joelcomp1 commented 1 year ago

Describe the bug

I have had issues both creating clusters and reading clusters using this provider. I constantly get a segmentation vault on use. In this specific case I am just trying to read the state of a existing cluster I used Tanzu Mission Control to create on AWS:

provider "tanzu-mission-control" { endpoint = var.tanzu-endpoint # optionally use TMC_ENDPOINT env var vmw_cloud_api_token = var.vmw-cloud-api-token # optionally use VMW_CLOUD_API_TOKEN env var

if you are using dev or different csp endpoint, change the default value below

for production environments the vmw_cloud_endpoint is console.cloud.vmware.com

vmw_cloud_endpoint = "console.cloud.vmware.com" or optionally use VMW_CLOUD_ENDPOINT env var

}

Where the endpoint is my URL per the read-me and my API token.

Error: Request cancelled │ │ with data.tanzu-mission-control_cluster.read_tkg_aws_cluster, │ on main.tf line 36, in data "tanzu-mission-control_cluster" "read_tkg_aws_cluster": │ 36: data "tanzu-mission-control_cluster" "read_tkg_aws_cluster" { │ │ The plugin.(*GRPCProvider).ReadDataSource request was cancelled. ╵

Stack trace from the terraform-provider-tanzu-mission-control_v1.1.2 plugin:

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

goroutine 100 [running]: github.com/vmware/terraform-provider-tanzu-mission-control/internal/resources/cluster.dataSourceTMCClusterRead({0x1a66d08, 0xc0006a3260}, 0xc0002e4d80, {0x16d9820?, 0xc000233d40?}) github.com/vmware/terraform-provider-tanzu-mission-control/internal/resources/cluster/data_source_cluster.go:134 +0xd67 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).read(0xc000231ce0, {0x1a66d40, 0xc00057c8d0}, 0xd?, {0x16d9820, 0xc000233d40}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.12.0/helper/schema/resource.go:359 +0x12e github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).ReadDataApply(0xc000231ce0, {0x1a66d40, 0xc00057c8d0}, 0xc0002e4d00, {0x16d9820, 0xc000233d40}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.12.0/helper/schema/resource.go:578 +0x145 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(GRPCProviderServer).ReadDataSource(0xc00000c588, {0x1a66c98?, 0xc0004484c0?}, 0xc0008218e0) github.com/hashicorp/terraform-plugin-sdk/v2@v2.12.0/helper/schema/grpc_provider.go:1179 +0x357 github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(server).ReadDataSource(0xc00045e320, {0x1a66d40?, 0xc00057c090?}, 0xc00045b5e0) github.com/hashicorp/terraform-plugin-go@v0.8.0/tfprotov5/tf5server/server.go:657 +0x409 github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadDataSource_Handler({0x1735960?, 0xc00045e320}, {0x1a66d40, 0xc00057c090}, 0xc0006a2e40, 0x0) github.com/hashicorp/terraform-plugin-go@v0.8.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:421 +0x170 google.golang.org/grpc.(Server).processUnaryRPC(0xc00021a380, {0x1a6a400, 0xc000103380}, 0xc000192a20, 0xc000286960, 0x25af1d0, 0x0) google.golang.org/grpc@v1.45.0/server.go:1282 +0xccf google.golang.org/grpc.(Server).handleStream(0xc00021a380, {0x1a6a400, 0xc000103380}, 0xc000192a20, 0x0) google.golang.org/grpc@v1.45.0/server.go:1619 +0xa1b 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-tanzu-mission-control_v1.1.2 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.

Reproduction steps

  1. terraform init -upgrade
  2. terraform apply

It will crash before the apply asks you for confirmation to apply the changes.

Expected behavior

Should show the terrafrom plan and then read in the cluster state into my terraform block.

Additional context

No response

Vasundharashukla commented 1 year ago

This issue has been fixed with PR: #79. Will be out in the next release. cc: @shreyassreenivas

joelcomp1 commented 1 year ago

Awesome thank you!