-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Terraform seems to ignore "skip_final_snapshot" for rds cluster #2588
Comments
From debug output,
|
@loivis that actually seems to capture the problem. Even though the .tf code shows |
I just took a quick look at the code and the only place I could find where that variable was being set to |
I have also encountered this bug with RDS read replicas, for which final snapshots do not even apply. |
This bug still exists (trying to destroy a Postgres RDS instance, Terraform v0.11.7). It seems to manifest if 'skip_final_snapshot' parameter was missing when the instance got created, and it's added later. If the 'skip_final_snapshot' was specified from the beginning, everything works correctly. |
Alright, so on a normal RDS instance I've found a way to easily replicate this bug and a proposed fix. Replication:
Suggested fix: If possible, it seems like a good idea to check if skip_final_snapshot = true via the config and NOT just the state. This would prevent the song and dance seen above. Right now, it is going soley by the state so if you end up in a state where skip_final_snapshot is already false, then it's only possible to fix this by ensuring that is set to true (Without modifying the state file manually, which is bad practice) |
Hit this also, please fix :) |
Even though I have mentioned skip_final_snapshot = "true", I am getting the below error:
Terraform v0.11.3
|
@rupsray See my comment here This should allow you to workaround the issue. If you examine your state file, you'll likely notice that it's not set to true and that it will attempt to destroy it before first changing skip_final_snapshot = "true" in the state file. |
This appears to still be broken over a year later. |
Not only is it still broken, there is another issue with the using skip_final_snapshot = false. If I set the final_snapshot_identifier to a constant name (e.g., mydb-final-snapshot), terraform destroy fails if the snapshot with that name already exists. While I understand why, there doesn't seem to be a good way to get around this limitation other than to manually delete the previous final snapshot or change the name of the final snapshot every time you run terraform destroy. Sigh... |
I hate to say this, but I keep running issues that have been for for 2, 3, 4, or 5 years that aren't fixed. They really need to do something about prioritizing issues based on how long they've been open. |
Is it they or us? Do they accept patches? Anyone willing to take these on? |
Being as this only affects RDS instances that were created without final snapshot policy set to enforced, I don't know if this is a bug so much as a good place to put some notifications that you can't change this option with TF. I would think if someone wanted it protected from the start, they wouldn't want some accidental change to some TF configurations to make it unprotected. |
I just tried to reproduce the original issue with the latest AWS provider and couldn't. @rpatrick00 I'm going to take a look at your issue tonight. |
Okay, I can reproduce and see what's going on here. For starters, This can be fixed but I don't really have a great story for those who already have prexisting state. One possibility would be that a delete operation ignores |
Thanks very much for taking the time to look into this. A randomized ID seems safest to me, if it is a UUID or base32'ed UUID or something guaranteed to be random. |
is this issue resolved or not ? I am using Terraform v0.12.23 and facing this issue. Tried with some workaround but its not working |
I opened a PR last year and it looks like there's now conflicting changes. I'll update the PR but I can only be hopeful this gets more notice. |
still an issue? lol |
I'm using:
And this is still an issue! Any plans to fix this bug? |
Same here:
|
I believe I have reproduced the same issue using Terraform 0.13-beta2:
After adding skip_final_snapshot = true, I still had skip_final_snapshot = false in the state file. I edited that to be also true, and I could delete the DB instance. |
I ran into the same issue here with Terraform 0.12.26. Any solutions for this? |
In my case I encountered this issue when trying to destroy my RDS resources.
(*) A more detailed answer is given here. (**) Running under: Terraform v0.12.28, provider.aws v2.70.0 |
Terraform Version 0.13.5 and still RDS instance deletion is not as clean and graceful as it should be. |
Still a problem with terraform v0.14.4. Can anyone point me in the right direction, I can try to fix this. |
I got around to updating this PR with the latest API and upstream changes. |
Any news? I've reproduced the same error using Terraform 0.14: Terraform v0.14.0
+ provider registry.terraform.io/hashicorp/aws v3.44.0 Error:
|
Experiencing this problem with
|
FWIW on Terraform v1.1.6 I encountered this bug as I had previously NOT set the "skip_final_snapshot" to anything, so the state file had it as "False". Updating my code to set this to "true" failed as it's looking at the state file first. So I updated my state file manually (terraform state pull > somefile.tfstate) then edited that switch to "true" from false, incremented the "serial" by one and terraform state push somefile.tfstate to get it back up. Now I can apply properly without that final snapshot trying to happen and failing. |
For me, I was able to add skip_final_snapshot, re-apply, and then I was able to destroy without issues. The issue is indeed the state is holding the default value of false, because there was not one specified. |
Excuse my ignorance, but why exactly do we need Shouldn't it be possible to deduce the expected value of Something along the lines of: |
Hi all, just providing a quick update on this issue. To solve this on the resource level we decided to utilize the Terraform Plugin Framework, which has better support for warnings during the This upgrade has been paused, for now, until we have a better understanding of the impact that these changes would have on existing resources. |
Has this issue been resolved? It still happens to me. terraform -v |
This is still an issue.
Code:
Variable:
Versions:
|
I even get the same error with these attribute combinations set:
or
or
Is there another attribute that forces skip_final_snapshot to be false? |
This is still not resolved with aws provider 5.31.0 and tf version 1.6.5 |
Was able to delete my cluster and redeploy with skip_final_snapshot = true and that appears to have stuck. Weird and frustrating for sure. |
We got the same issue |
Still happening in 2024. 7 years now. |
Still happening in Oct 2024. 7 years now. Why ?! |
is there an update on this issue? |
This issue was originally opened by @andrei-dascalu as hashicorp/terraform#16861. It was migrated here as a result of the provider split. The original body of the issue is below.
Hello,
I'm not sure if the following is a terraform or aws provider issue but it sure seems like it's an issue as in my case the request behaves as if "skip_final_snapshot" isn't set or it's always true and it's expecting a "final_snapshot_identifier" (though even when provided the error claims it's not there). I've linked a similar issue as well.
Thanks!
Terraform Version
Terraform Configuration Files
Debug Output
https://gist.github.com/andrei-dascalu/9eaaa3491b5ad77f7e4f8c4f11dc960a
Expected Behavior
RDS Cluster with 2 instances created
Actual Behavior
Error:
1 error(s) occurred:
aws_rds_cluster.example (destroy): 1 error(s) occurred:
aws_rds_cluster.example: RDS Cluster FinalSnapshotIdentifier is required when a final snapshot is required
Steps to Reproduce
run: terraform apply
References
The text was updated successfully, but these errors were encountered: