rancher / terraform-provider-rancher2

Terraform Rancher2 provider
https://www.terraform.io/docs/providers/rancher2/
Mozilla Public License 2.0
253 stars 219 forks source link

[BUG] signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0xe6ef9b #1248

Open cdg-Charter opened 9 months ago

cdg-Charter commented 9 months ago

Rancher Server Setup

Information about the Cluster

User Information

Provider Information

Describe the bug

output of terraform apply --var-file=... module.rancher_cluster.rancher2_cluster.rancher-cluster[0]: Creating... ╷ │ Error: Plugin did not respond │ │ with module.rancher_cluster.rancher2_cluster.rancher-cluster[0], │ on ../../modules/rancher/main.tf line 5, in resource "rancher2_cluster" "rancher-cluster": │ 5: resource "rancher2_cluster" "rancher-cluster" { │ │ 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-rancher2_v1.23.0 plugin:

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

goroutine 161 [running]: github.com/rancher/norman/clientbase.(APIOperations).DoByID(0x0, 0x222b5e8, 0x7, 0x223195f, 0xb, 0x1de3540, 0xc001398000, 0x25ab458, 0xc0000b66c0) /go/pkg/mod/github.com/rancher/norman@v0.0.0-20220107203912-4feb41eafabd/clientbase/ops.go:251 +0x9b github.com/rancher/rancher/pkg/client/generated/management/v3.(SettingClient).ByID(0xc0007b81b0, 0x223195f, 0xb, 0x25ab458, 0xc0000b66c0, 0xc001394010) /go/pkg/mod/github.com/rancher/rancher/pkg/client@v0.0.0-20220309231411-e4af2465c5b4/generated/management/v3/zz_generated_setting.go:120 +0x89 github.com/rancher/terraform-provider-rancher2/rancher2.(Config).getK8SDefaultVersion(0xc00016a0c0, 0x0, 0x0, 0x0, 0x0) /go/src/github.com/rancher/terraform-provider-rancher2/rancher2/config.go:135 +0xfe github.com/rancher/terraform-provider-rancher2/rancher2.(Config).ManagementClient(0xc00016a0c0, 0x0, 0x0, 0x0) /go/src/github.com/rancher/terraform-provider-rancher2/rancher2/config.go:285 +0x1d2 github.com/rancher/terraform-provider-rancher2/rancher2.resourceRancher2ClusterCreate(0xc0007f6b60, 0x2221dc0, 0xc00016a0c0, 0x0, 0x0) /go/src/github.com/rancher/terraform-provider-rancher2/rancher2/resource_rancher2_cluster.go:120 +0x7a github.com/hashicorp/terraform-plugin-sdk/helper/schema.(Resource).Apply(0xc000386ab0, 0xc001134e10, 0xc0011309a0, 0x2221dc0, 0xc00016a0c0, 0x1f19701, 0xc000c5da78, 0xc00098b2f0) /go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.14.0/helper/schema/resource.go:310 +0x375 github.com/hashicorp/terraform-plugin-sdk/helper/schema.(Provider).Apply(0xc00082c980, 0xc000a37a38, 0xc001134e10, 0xc0011309a0, 0xc0007c1a68, 0xc0008603b0, 0x1f1cca0) /go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.14.0/helper/schema/provider.go:294 +0x99 github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(GRPCProviderServer).ApplyResourceChange(0xc0007b9da8, 0x25ab490, 0xc0010ef110, 0xc0007f6000, 0xc0007b9da8, 0xc0010ef110, 0xc000d5eba0) /go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.14.0/internal/helper/plugin/grpc_provider.go:885 +0x8a5 github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x21542a0, 0xc0007b9da8, 0x25ab490, 0xc0010ef110, 0xc000280660, 0x0, 0x25ab490, 0xc0010ef110, 0xc0001a7800, 0x70a) /go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.14.0/internal/tfplugin5/tfplugin5.pb.go:3305 +0x214 google.golang.org/grpc.(Server).processUnaryRPC(0xc00017c540, 0x25c33d8, 0xc000c8a680, 0xc0010f3b00, 0xc0008b8510, 0x346de40, 0x0, 0x0, 0x0) /go/pkg/mod/google.golang.org/grpc@v1.43.0/server.go:1282 +0x52b google.golang.org/grpc.(Server).handleStream(0xc00017c540, 0x25c33d8, 0xc000c8a680, 0xc0010f3b00, 0x0) /go/pkg/mod/google.golang.org/grpc@v1.43.0/server.go:1616 +0xd0c google.golang.org/grpc.(Server).serveStreams.func1.2(0xc000057740, 0xc00017c540, 0x25c33d8, 0xc000c8a680, 0xc0010f3b00) /go/pkg/mod/google.golang.org/grpc@v1.43.0/server.go:921 +0xab created by google.golang.org/grpc.(*Server).serveStreams.func1 /go/pkg/mod/google.golang.org/grpc@v1.43.0/server.go:919 +0x1fd

Error: The terraform-provider-rancher2_v1.23.0 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.

To Reproduce

set "insecure = true" in rancher provider plugin provide ca-checksum signature in ca_certs_rancher of local tfvars file (the file loaded into terraform plan --var-file=); terraform apply --var-file=

Actual Result

terraform apply...: applied up to the point of calling the rancher2 plugin - the plugin connected to rancher and then provided the memory corruption runtime error provided above

Expected Result

terraform plugin connects to rancher and initiates the tenant cluster create activity, then provisions nodes in vsphere

Screenshots

Screenshot 2023-10-09 at 9 41 39 AM

Additional context

The rancher management cluster uses a self-signed cert and has successfully hosted imported clusters in the past. The connection issues of the noted terraform plugin were resolved - 401 authentication required and x509 certificate errors resolved, then terraform plan command run again and the bug reported here was presented by terraform output