terraform-provider-rancher2 icon indicating copy to clipboard operation
terraform-provider-rancher2 copied to clipboard

[BUG] Provider crash on changing rancher2_custom_user_token's password

Open mouellet opened this issue 8 months ago • 1 comments

Rancher Server Setup

  • Rancher version: v2.8.2

Information about the Cluster

  • Kubernetes version: v1.27.11
  • Cluster Type: Downstream/Custom/Azure

User Information

N/D

Provider Information

  • What is the version of the Rancher v2 Terraform Provider in use? v4.1.0
  • What is the version of Terraform in use? v1.5.7

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

Tokens can't be updated once created. Any diff in token data will recreate the token. If any token expire, Rancher2 provider will generate a diff to regenerate it.

https://github.com/rancher/terraform-provider-rancher2/blob/master/docs/resources/custom_user_token.md?plain=1#L51

password - (Required/ForceNew) The user password (string)

To Reproduce

  1. create a rancher2_custom_user_token resource
  2. change the password attribute

Actual Result

│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to
│ rancher2_custom_user_token.this,
│ provider "provider[\"registry.terraform.io/rancher/rancher2\"]" produced an
│ unexpected new value: Root resource was present, but now absent.
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.
╵

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

mouellet avatar May 29 '24 18:05 mouellet