Skip to content

[Feature] Please add validation on the ca_certs provider argument #1801

@matttrach

Description

@matttrach

Environment Information

  • Terraform version: v1.5.7
  • Rancher2 Provider version: v8.3.1
  • Rancher version: v2.12.3
  • Operating System of the Rancher Node: SLEMicro 6.1
  • Operating System of the machine running Terraform: darwin_arm64
  • Kubernetes Distro (k3s/rke2): rke2
  • Kubernetes Version: v1.32.9+rke2r1
  • Infrastructure Provider (AWS/GCP/vSphere/etc): AWS
  • What is the scope of the token given to the provider? admin

Describe the Problem

The provider is failing to bootstrap with a panic. 
  # rancher2_bootstrap.admin will be created
   resource "rancher2_bootstrap" "admin" {
       current_password   = (sensitive value)
       id                               = (known after apply)
       initial_password       = (sensitive value)
       password                  = (sensitive value)
       temp_token              = (sensitive value)
       temp_token_id         = (known after apply)
       token                         = (sensitive value)
       token_id                    = (known after apply)
       token_ttl                    = 7200
       token_update            = true
       ui_default_landing    = "ember"
         url      = (known after apply)
         user   = (known after apply)
     }


 Error: Request cancelled
   with rancher2_bootstrap.admin,
   on main.tf line 14, in resource "rancher2_bootstrap" "admin":
   14: resource "rancher2_bootstrap" "admin" {

 The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.

 Stack trace from the terraform-provider-rancher2_v8.3.1 plugin:
 panic: runtime error: invalid memory address or nil pointer dereference
 [signal SIGSEGV: segmentation violation code=0x2 addr=0x8 pc=0x1051a9658]
 goroutine 83 [running]:
 github.com/rancher/norman/clientbase.(*APIOperations).DoByID(0x0, {0x106050223, 0x7}, {0x106056f8d, 0xb}, {0x1065fdb40, 0x14000750a80})
 github.com/rancher/norman@v0.5.2/clientbase/ops.go:250 +0x58
 github.com/rancher/rancher/pkg/client/generated/management/v3.(*SettingClient).ByID(0x140001318c8, {0x106056f8d, 0xb})
 github.com/rancher/rancher/pkg/client@v0.0.0/generated/management/v3/zz_generated_setting.go:120 +0x68
 github.com/rancher/terraform-provider-rancher2/rancher2.(*Config).getK8SDefaultVersion(0x140006cc180)
 github.com/rancher/terraform-provider-rancher2/rancher2/config.go:133 +0xfc
 github.com/rancher/terraform-provider-rancher2/rancher2.(*Config).ManagementClient(0x140006cc180)
 github.com/rancher/terraform-provider-rancher2/rancher2/config.go:250 +0x1dc
 github.com/rancher/terraform-provider-rancher2/rancher2.(*Config).RestartClients(0x140006cc180)
 github.com/rancher/terraform-provider-rancher2/rancher2/config.go:216 +0x100
 github.com/rancher/terraform-provider-rancher2/rancher2.(*Config).UpdateToken(0x14000990060?, {0x140000584b0?, 0x10604d291?})
 github.com/rancher/terraform-provider-rancher2/rancher2/config.go:205 +0x48
 github.com/rancher/terraform-provider-rancher2/rancher2.bootstrapDoLogin(0x1400110f3b0, {0x106aecae0, 0x140006cc180})
 github.com/rancher/terraform-provider-rancher2/rancher2/resource_rancher2_bootstrap.go:255 +0x3dc
 github.com/rancher/terraform-provider-rancher2/rancher2.resourceRancher2BootstrapCreate(0x1400110f3b0, {0x106aecae0, 0x140006cc180})
 github.com/rancher/terraform-provider-rancher2/rancher2/resource_rancher2_bootstrap.go:27 +0x4c
 github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).Apply(0x14000998c80, 0x1400113c0f0, 0x14001110c60, {0x106aecae0, 0x140006cc180})
 github.com/hashicorp/terraform-plugin-sdk@v1.17.2/helper/schema/resource.go:320 +0x500
 github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).Apply(0x1400099a000, 0x1400007b828, 0x1400113c0f0, 0x14001110c60)
 github.com/hashicorp/terraform-plugin-sdk@v1.17.2/helper/schema/provider.go:294 +0x6c
 github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0x14000130690, {0x106a1aee0?, 0x140008208b8?}, 0x1400110ee00)
 github.com/hashicorp/terraform-plugin-sdk@v1.17.2/internal/helper/plugin/grpc_provider.go:895 +0x674
 github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x106a1aee0, 0x14000130690}, {0x106b28418, 0x14001138150}, 0x1400111f080, 0x0)
 github.com/hashicorp/terraform-plugin-sdk@v1.17.2/internal/tfplugin5/tfplugin5.pb.go:3305 +0x1c0
 google.golang.org/grpc.(*Server).processUnaryRPC(0x140008b6000, {0x106b28418, 0x140011380c0}, 0x140007c6600, 0x14000f81ce0, 0x107e762e0, 0x0)
 google.golang.org/grpc@v1.70.0/server.go:1400 +0xca8
 google.golang.org/grpc.(*Server).handleStream(0x140008b6000, {0x106b28ef8, 0x1400076a000}, 0x140007c6600)
 google.golang.org/grpc@v1.70.0/server.go:1810 +0x910
 google.golang.org/grpc.(*Server).serveStreams.func2.1()
 google.golang.org/grpc@v1.70.0/server.go:1030 +0x84
 created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 44
 google.golang.org/grpc@v1.70.0/server.go:1041 +0x13c

 Error: The terraform-provider-rancher2_v8.3.1 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.

Here is my config:

locals {
  rancher_domain  = var.rancher_domain
  ca_certs               = var.ca_certs
  admin_password = var.admin_password
}

provider "rancher2" {
  api_url   = "https://${local.rancher_domain}"
  bootstrap = true
  ca_certs  = local.ca_certs
  timeout   = "300s"
}

resource "rancher2_bootstrap" "admin" {
  initial_password = local.admin_password
  password            = local.admin_password
  token_update     = true
  token_ttl             = 7200 # 2 hours
}

Metadata

Metadata

Assignees

Labels

area/authenticationThis appears to be related to authentication.internal/userThis is a problem identified by a user.kind/featureThis is requesting a new feature specifically for the provider.status/backlogThis issue is waiting for someone to be available to work it.
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions