Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting doks PAT is not detected by provider #727

Open
dmikalova opened this issue Oct 23, 2021 · 2 comments
Open

Deleting doks PAT is not detected by provider #727

dmikalova opened this issue Oct 23, 2021 · 2 comments

Comments

@dmikalova
Copy link

Bug Report


Describe the bug

I cleaned out my PATs including the ones generated by doks. When rerunning terraform plan and apply, this is not noticed by the provider, so the kube_config output does not update.

Affected Resource(s)

  • digitalocean_kubernetes_cluster

Expected Behavior

After deleting the PAT that is output in kube_config, and then rerunning plan, the provider should notice that the PAT is gone and plan to generate a new one.

Actual Behavior

The PAT is not regenerated, and the old kube_config persists. Other modules using terraform_remote_state will get unauthorized errors.

@baznikin
Copy link

baznikin commented Mar 27, 2024

Confirm! I got my PAT deleted yesterday, replaced it in provider config, but doks token do not renewed in state so all my attempts to use kubernetes provider lead to Unauthorized errors. Same for helm provider - Kubernetes cluster unreachable: the server has asked for the client to provide credentials.

Steps to reproduce:

  1. work with DO via Terraform (in order to fill/refresh terraform state) - create digitalocean_kubernetes_cluster and some resources using kubernetes provider
  2. delete used PAT token
  3. add new token
  4. try to apply or refresh again

@baznikin
Copy link

Workaround - remove cluster from state and import it back:

$ terraform state rm module.k8s.digitalocean_kubernetes_cluster.cluster
Removed module.k8s.digitalocean_kubernetes_cluster.cluster
Successfully removed 1 resource instance(s).
$ terraform import module.k8s.digitalocean_kubernetes_cluster.cluster 3299306e-aea3-4b55-ab66-redacted      

Import successful!

The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants