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
RDS option group can't delete #4597
Comments
If the same option group is used by different resource then we will get this issue, i have no issue on delete, if its only assigned to one resource. can find the dependency below: |
The RDS option group is used by final DB snapshot. Terraform doesn't know anything about it. Option group can be removed only when final snapshot is removed. |
I still can not |
... even after having configured |
+1 @mattiaperi , don't think its terraform issue. |
Delete options first and try option group. |
Hi all, I'm back with AWS feedback. In my case, I just needed to wait for a couple of days, when I tried again everything went smoothly. Hope this can help you, |
Couple days.. seems a bit too long. |
Hi all, just to be precise: I tried a couple of days later, maybe it was only a matter of minutes/hours, can't say with absolute precision, sorry about that :) |
In case this helps: I had a similar issue when destroying SQL Server Enterprise RDS instances. After waiting for about 30m, I was able to delete the |
v.0.11.10
|
Any updates on this one please. |
Same issue. Unable to destroy option_group though it is not associated with any resource. Is there any way to destroy/skipping it getting to be destroyed? |
You can attempt to handle it with extended timeouts, not a perfect solution of course: https://www.terraform.io/docs/providers/aws/r/db_option_group.html#timeouts resource "aws_db_option_group" "options" {
timeouts {
delete = "2h"
}
} |
I manually deleted the associated snapshot and was then able to destroy the option group. |
In some cases removing the aws_db_option group will fail complaing that the option group is still in use, when it is not. This happens because of a internal snapshot create by AWS (see issue hashicorp#4597), and the solution is to wait before trying again. Feel free to just close this PR if we don't think this is a good idea. Signed-off-by: fernandoalex <jfernandoalex@gmail.com>
In some cases removing the aws_db_option group will fail complaing that the option group is still in use, when it is not. This happens because of a internal snapshot create by AWS (see issue #4597), and the solution is to wait before trying again. Feel free to just close this PR if we don't think this is a good idea. Signed-off-by: fernandoalex <jfernandoalex@gmail.com>
Not sure if anyone still have issue with this, I had
|
In my case, since I wanted to recreate the RDS instance with the same option group, I just let the destroy fail. Then I imported each option group and re-used them. It was faster than waiting. |
I hit this one today trying to rename some rds instances in console (tf can't do it) and reflect those changes in my tf configuration/state. Not convinced there's much that can be done from terraform side. For instances with no snapshots (no final snapshot, no auto backups) terraform timed out trying to delete option group (it also errored from AWS CLI) on tf apply (where it wanted to -/+ my option_group). The workaround was to switch option group to the default for my db engine, wait for instance modification to complete (about 5 minutes - realise this is fraught) and then terraform was able to recreate the OG. In a different instance, where I had auto backup enabled. I tried to preempt the error by switching my instance to use the default option group before running destroy. RDS auto backups are also linked to option group, so the delete still failed. Spoke to AWS RDS support, and my only option was to disable backups, change option group, enable backups. Yikes. |
Unfortunately this bug can not be fixed on the Terraform side. This is a well-known issue with RDS service itself: DB takes some system snapshots that you can't manage or delete. The only solution is to wait for hours/days for it to be automatically deleted. I suggest closing this one as there is literally no solution that could be made on Terraform side except possibly adding some information to the documentation, |
I agree with @nick4fake, but adding information documention side would be very helpful IMHO. |
Going to close this as it doesn't seem resolvable on the provider side. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
This issue was originally opened by @debu99 as hashicorp/terraform#18084. It was migrated here as a result of the provider split. The original body of the issue is below.
module.rds.aws_db_option_group.rds-option-group (destroy): 1 error(s) occurred:
aws_db_option_group.rds-option-group: Error Deleting DB Option Group: InvalidOptionGroupStateFault: The option group 'rds-5-7-audit-test-test' cannot be deleted because it is in use.
status code: 400, request id: 16db0e71-751a-497c-9a18-a034631b89fc
actually the rds has already been deleted, but it still can't delete, below is my code
Terraform v0.11.7
resource "aws_db_option_group" "rds-option-group" {
name = "rds-5-7-audit-${lower(var.stage_name)}-${lower(var.environment_name)}"
option_group_description = "MySQL 5.7 Audit Option Group"
engine_name = "mysql"
major_engine_version = "5.7"
option {
option_name = "MARIADB_AUDIT_PLUGIN"
}
tags {
Name = "${var.environment_name} ${var.stage_name} RDS Option Group"
Environment = "${var.environment_name}"
Stage = "${var.stage_name}"
Type = "OptionGroup"
}
}
The text was updated successfully, but these errors were encountered: