Hi,
When attempting to delete an AWS Backup Vault using Terraform with force_destroy set to true, Terraform fails on the first try with the error message "Backup vault cannot be deleted because it contains recovery points." However, upon inspection, it's observed that the recovery points are indeed deleted from the console after the initial failure. Subsequently, on the second apply, the recovery point value becomes 0, and the AWS Backup Vault is removed successfully without any issues.
Expected Behavior
Terraform should successfully delete the AWS Backup Vault on the first attempt when force_destroy is set to true, regardless of the presence of recovery points.
Actual Behavior
Terraform fails on the first attempt to delete the AWS Backup Vault, with the presence of recovery points. However, the recovery points are deleted, and the second apply will successfully remove the aws_backup_vault resource.
Relevant Error/Panic Output Snippet
Error Message (First Apply):
Error: deleting Backup Vault (dev-rds-vault): InvalidRequestException: Backup vault cannot be deleted because it contains recovery points.
{
RespMetadata: {
StatusCode: 400,
RequestID: "0e9fa73d-75ab-4a94-9197-adadf35e632c"
},
Code_: "ERROR_9101",
Message_: "Backup vault cannot be deleted because it contains recovery points."
}
Terraform Configuration Files
resource "aws_backup_vault" "this" {
name = "dev-rds-vault"
force_destroy = true
# Other attributes...
}
Steps to Reproduce
Set up Terraform configuration with an AWS Backup Vault resource and set force_destroy to true with the existence of recovery points.
Apply the destroy plan to delete the AWS Backup Vault.
Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
Volunteering to Work on This Issue
If you are interested in working on this issue, please leave a comment.
If this would be your first contribution, please review the contribution guide.
Terraform Core Version
1.5.7
AWS Provider Version
5.51.1
Affected Resource(s)
Hi, When attempting to delete an AWS Backup Vault using Terraform with
force_destroy
set totrue
, Terraform fails on the first try with the error message "Backup vault cannot be deleted because it contains recovery points.
" However, upon inspection, it's observed that the recovery points are indeed deleted from the console after the initial failure. Subsequently, on the second apply, the recovery point value becomes 0, and theAWS Backup Vault
is removed successfully without any issues.Expected Behavior
Terraform should successfully delete the AWS Backup Vault on the first attempt when force_destroy is set to true, regardless of the presence of recovery points.
Actual Behavior
Terraform fails on the first attempt to delete the AWS Backup Vault, with the presence of recovery points. However, the recovery points are deleted, and the second apply will successfully remove the aws_backup_vault resource.
Relevant Error/Panic Output Snippet
Terraform Configuration Files
Steps to Reproduce
Debug Output
Terraform Output (First Apply - Plan):
Terraform Output (Second Apply - Plan):
Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
None