-
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
Add force_delete to aws_backup_vault resource #13247
Comments
This. I envision this to be an implementation very similar to the S3 "force_destroy" attribute that deletes all bucket objects when a bucket is deleted. Pretty clear example of that implementation in the code for aws_s3_bucket. If I get a little time I'll implement it, but I'm more than happy if someone else does it before me! |
Following.. |
Following... 100 votes for this one. |
"Slightly" 😉 dangerous but would be useful to have. |
How to deal with this ? The whole destroy operation just crashes because of this. Cant remove RDS, EC2 ... but I don't care if there are backups or not, if I'm calling destroy and that include backup vault and plans it should all go away... |
I needed to add this as step before terraform destroy:
Wish there was a toggle for this inside Terraform. |
Hi, I'm also interest about this feature. |
Also interested in that. |
I'm also interested in that. |
Hi everyone, I might have found a workaround for this while the issue is closed. First we create a script, in my case in the file location existing_arns=$(aws backup list-recovery-points-by-backup-vault --backup-vault-name "$1" --region "$2" --query 'RecoveryPoints[].RecoveryPointArn' --output text)
existing_arns_amount=$(echo $existing_arns | wc -w)
for arn in $existing_arns; do
echo "deleting ${arn} ..."
aws backup delete-recovery-point --backup-vault-name "$1" --region "$2" --recovery-point-arn "${arn}"
done
while [[ $existing_arns_amount -gt 0 ]] ;
do
sleep 3
existing_arns_amount=$(aws backup list-recovery-points-by-backup-vault --backup-vault-name "$1" --region "$2" --query 'RecoveryPoints[].RecoveryPointArn' --output text | wc -w)
done Then, in our Terraform we add a "local-exec" provisioner on the resource "aws_backup_vault" "this" {
#...
provisioner "local-exec" {
command = format(
"bash ./scripts/delete_vault_backups.sh %s %s",
self.name,
split(":", self.arn)[3]
)
when = destroy
}
} This will make sure that all Vault Recovery Points are delete before the |
@CMarriaga thanks for the workaround! |
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. |
Community Note
Terraform Version
0.12.8
Affected Resource(s)
Debug Output
Expected Behavior
Expect to be able to force delete the resource.
Actual Behavior
See error above.
Steps to Reproduce
Create and try to destroy destroy aws_backup_vault resource with existing recovery points.
The text was updated successfully, but these errors were encountered: