Closed mouellet closed 2 months ago
Thank you so much! I agree with your assessment, I will work on making this change for our next release.
Validated that I do not see a crash in rancher2_custom_resource
with 5.0.0-rc1. See details below:
ENVIRONMENT DETAILS
main
https://github.com/rancher/rancher/commit/78a3ca992970297f8fc3df0ade8cea189ae5fc685.0.0-rc1
TEST RESULTS | # | Scenario | Test Result |
---|---|---|---|
1 | Updating password recreates the custom user token |
:white_check_mark: |
VALIDATION STEPS
v1.30.4+k3s1
cluster.main.tf
:terraform {
required_providers {
rancher2 = {
source = "terraform.local/local/rancher2"
version = "5.0.0-rc1"
}
}
}
provider "rancher2" {
api_url = "<omitted>"
token_key = "<omitted>"
insecure = true
}
resource "rancher2_user" "testuser" {
name = "<omitted>"
username = "<omitted>"
password = "<omitted>"
enabled = true
}
resource "rancher2_global_role_binding" "testuser-login" {
name = "<omitted>"
global_role_id = "user-base"
user_id = rancher2_user.testuser.id
}
resource "rancher2_custom_user_token" "testuser" {
username = rancher2_user.testuser.username
password = "<omitted>"
description = "test user token"
cluster_id = "<omitted>"
depends_on = [
rancher2_global_role_binding.testuser-login
]
}
terraform apply
.outputs.tf
, I have the following:output "testuser" {
value = rancher2_custom_user_token.testuser.token
sensitive = true
}
Ran `terraform output testuser-token and took note of the token.
terraform apply
.terraform output testuser-token
and noted there is a new token. Additionally, the terraform plan noted that rancher2_custom_user_token.testuser
was replaced as well.
Rancher Server Setup
Information about the Cluster
User Information
N/D
Provider Information
Describe the bug
Changing the 'password' attribute of the
rancher2_custom_user_token
resource doesn't recreate it as documented.https://github.com/rancher/terraform-provider-rancher2/blob/master/docs/resources/custom_user_token.md?plain=1#L15
https://github.com/rancher/terraform-provider-rancher2/blob/master/docs/resources/custom_user_token.md?plain=1#L51
To Reproduce
rancher2_custom_user_token
resourceActual Result
Expected Result
Resource should be recreated
Screenshots
Additional context
Schema is missing a
ForceNew: true,
here: https://github.com/rancher/terraform-provider-rancher2/blob/master/rancher2/schema_custom_user_token.go#L11-L16