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

Query the resource version prior to making an update #46

Merged
merged 6 commits into from
Feb 14, 2024

Conversation

swgillespie
Copy link
Collaborator

Storing the resource version in Terraform state doesn't quite do what we'd expect. If we tell Terraform that it is computed, we aren't able to read it during apply and thus can't pass it as part of the request. If we tall Terraform that it is not computed, it is assumed to be constant, and Terraform will bark at us when we attempt to mutate it.

To remedy this, we read the namespace just before updating or deleting it to get a recent resource version and use that in the request. If a concurrent request causes the update or delete to fail, the user will need to run terraform apply again.

Storing the resource version in Terraform state doesn't quite do what we'd expect. If we tell Terraform that it is computed, we aren't able to read it during `apply` and thus can't pass it as part of the request. If we tall Terraform that it is not computed, it is assumed to be constant, and Terraform will bark at us when we attempt to mutate it.

To remedy this, we read the namespace just before updating or deleting it to get a recent resource version and use that in the request. If a concurrent request causes the update or delete to fail, the user will need to run `terraform apply` again.
@swgillespie swgillespie requested a review from a team as a code owner February 14, 2024 00:35
@swgillespie swgillespie requested a review from a team February 14, 2024 00:37
@swgillespie swgillespie merged commit b2566bd into main Feb 14, 2024
16 checks passed
@swgillespie swgillespie deleted the swgillespie/get-resource-version branch February 14, 2024 01:11
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

Successfully merging this pull request may close these issues.

1 participant