-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Don't clear cluster from state if cleanup fails #2030
Don't clear cluster from state if cleanup fails #2030
Conversation
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesNo diff detected in terraform-google-conversion. New Pull RequestsI built this PR into one or more new PRs on other repositories, and when those are closed, this PR will also be merged and closed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at this combined with #2021, if I created a cluster in an error state and it failed to get deleted it will be persisted to state. Then on the next modification of the cluster, assuming it's a terminal error like in the original issue, I'd receive an error message because the cluster is in an error state. Is that your expectation too?
third_party/terraform/resources/resource_container_cluster.go.erb
Outdated
Show resolved
Hide resolved
I would hope that the cluster should remain in state but be tainted so that on the next plan/apply it should mark it as force replace. |
f940024
to
344fadd
Compare
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesterraform-provider-google-beta already has an open PR. New Pull RequestsI didn't open any new pull requests because of this PR. |
344fadd
to
92c0467
Compare
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesterraform-provider-google-beta already has an open PR. New Pull RequestsI didn't open any new pull requests because of this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mind commenting with our expectations of what will happen when a user hits this particular case at L#1107? Since we'll see Terraform taint the resource but fail to be able to delete it, it's a little unintuitive and should provide useful context when we revisit this in the future.
If you're able to get debug logs for when users enter this state, I'd be curious if a retry on the delete call would help as well.
In reality it looks like this will leave the cluster in terraform state, but will error out on read and refresh. It's not ideal since somebody will need to clean up the dangling cluster before terraform will run again but it gets us 1 step closer to a better world IMO. This is because it will be explicit about the error'ed cluster rather than silently causing a dangling resource and erroring on the next apply due to a resource collision. For what it's worth the "taint on failure to create" behavior only exists in 0.12 and is not the behavior in 0.11 where it will just be stored in state and will continue to just error on refresh. |
Tracked submodules are build/terraform-beta build/terraform-mapper build/terraform build/ansible build/inspec.
92c0467
to
b21e193
Compare
Fixes hashicorp/terraform-provider-google#3875
Release Note for Downstream PRs (will be copied)