-
Notifications
You must be signed in to change notification settings - Fork 371
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
Handle "release not found" errors thrown on uninstall / equivalent to helm uninstall --ignore-not-found
#1488
Comments
helm uninistall --ignore-not-found
helm uninstall --ignore-not-found
Thank you @sbocinec for the issue and PR. Normally we treat 404 errors in the DELETE methods as a "success" so Terraform removes the resource from state. So no need to use the --ignore-not-found flag we should have been doing this by default. Prefer the PR to address this explicitly check 404/not found and swallow the error (meaning success). It would look something like this
If you'd like to update #1487 to do that instead? Otherwise I can open a PR to fix it. UPDATE:
Bonus points if you use |
Thank you @appilon for your reply. I'm not sure about your proposal. It makes the code dependent on the exact error message content. Checking the upstream code how the
and returns I think it's much less error prone to go use the upstream provided option than to assume any error content. Ofc, I can modify the PR if you have a strong opinion about. EDIT: |
I'm finding the upstream code is a bit of a misnomer
The error isn't checked I'm assuming it could be any number of errors, IMO this behavior should be described as Although it might feel like a pain, I think its better if the provider explicitly checks the errors and makes the decision on if it thinks "the release no longer exists". Terraform ultimately wants you to be confident there are no dangling resources. Provider code is often quite messy as a result. Sadly this often means check for a few known substrings that semantically mean the same thing, and probably down the road some third or fourth error that semantically means the same thing will have to be added. Provider codebases are often just a bunch of "heuristics" stapled together. |
Completely agree, checking the code yesterday I thought the same. Anyway, I have updated the PR following your suggestion. I have also added an acceptance test, but I feel it's false positive, as playing with the terraform-plugin-testing framework I was never able to make the test to fail on a destroy. |
Description
We are frequently hitting an issue with
helm
TF provider failing to destroy ahelm_release
resource when a K8s cluster (specifically GKE 1.28) throws anInternal Server Error
andterraform destroy
than fails with:Retrying the destroy operation then fails with
release not found
uninstallation error, e.g.:as the
helm_release
resource remains in the TF state, but its resources are already deleted from the K8s cluster.In our case, we are destroying whole cluster so we want to ignore such errors. Helm CLI already provides a solution for this specific situation:
helm uninstall --ignore-not-found
:Potential Terraform Configuration
#1487
Add
ignore_not_found
boolean attribute (defaulting tofalse
) to thehelm_release
resource, enabling to ignore the error on uninstall.References
Community Note
The text was updated successfully, but these errors were encountered: