Skip to content

Tokens won't be recreated once removed #54

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

Open
lohrm-stabl opened this issue Mar 13, 2025 · 1 comment
Open

Tokens won't be recreated once removed #54

lohrm-stabl opened this issue Mar 13, 2025 · 1 comment

Comments

@lohrm-stabl
Copy link

lohrm-stabl commented Mar 13, 2025

Normally, if you create drift by removing a resource from the deployed infrastructure, Terraform will try to re-create the resource as it is still specified in the state.

This is not the case with the token resource in this provider.
E.g. if i delete a Token, which was created using Terraform, I get the following error:

Planning failed. Terraform encountered an error while generating this plan.
╷
│ Error: Unable to read token
│ 
│   with axiom_token.axiom_token_analytics_prod,
│   on cdk.tf.json line 227, in resource.axiom_token.axiom_token_analytics_prod:
│  227:       },
│ 
│ API error 404: Not Found
╵

This can be worked around by removing the resource from the state first using terraform state rm axiom_token.axiom_token_analytics_prod.

@lohrm-stabl
Copy link
Author

A really stupid workaround is to manually remove all those resources at once from the state:

terraform state list -no-color | grep '^axiom_token\.' | xargs -n1 terraform state rm

Or actually destroying them right away

terraform state list -no-color | grep '^axiom_token\.' | xargs -n1 -I {} terraform destroy -target={} -auto-approve -input=false -no-color

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

No branches or pull requests

1 participant