Skip to content
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

Backup Plan deletion fails randomly #10414

Closed
ghost opened this issue Oct 7, 2019 · 4 comments · Fixed by #16476
Closed

Backup Plan deletion fails randomly #10414

ghost opened this issue Oct 7, 2019 · 4 comments · Fixed by #16476
Labels
bug Addresses a defect in current functionality. service/backup Issues and PRs that pertain to the backup service.
Milestone

Comments

@ghost
Copy link

ghost commented Oct 7, 2019

Hi!

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v0.11.14
provider.aws v2.19.0
provider.random v2.2.1

Affected Resource(s)

  • aws_backup_selection
  • aws_backup_plan

Terraform Configuration Files

Code can be found here: https://scm.dazzlingwrench.fxinnovation.com/fxinnovation-public/terraform-module-aws-backup/pulls/2/files

Expected Behavior

I expect all resources to be destroyed without issue.

Actual Behavior

Randomly, Terraform fails to delete Backup Plan, saying Backup Selections should be deleted before:

Error: Error applying plan:

1 error occurred:
	* module.default.aws_backup_plan.this (destroy): 1 error occurred:
	* aws_backup_plan.this: error deleting Backup Plan: InvalidRequestException: Related backup plan selections must be deleted prior to backup plan deletion
	status code: 400, request id: 170f2b1c-156e-4e77-97e3-9aacbd9b6d02

Even if the actual order of deletion is correct:

module.default.aws_backup_selection.by_resources: Destruction complete after 1s
module.default.aws_backup_selection.by_tags: Destruction complete after 1s
aws_ebs_volume.example: Destroying... (ID: vol-0f6fecced036d1281)
module.default.aws_iam_role.this: Destroying... (ID: tftestbtsaul9fRole)
module.default.aws_backup_plan.this: Destroying... (ID: 170f2b1c-156e-4e77-97e3-9aacbd9b6d02)

My bet is that AWS API returns an OK status for Backup Selection deletion before it’s actually true…

Steps to Reproduce

  1. terraform apply
  2. terraform destroy
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Oct 7, 2019
@DrFaust92 DrFaust92 added the service/backup Issues and PRs that pertain to the backup service. label May 21, 2020
@DrFaust92 DrFaust92 added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Nov 10, 2020
@DrFaust92
Copy link
Collaborator

ill add a timeout for the InvalidRequestException: Related backup plan selections must be deleted prior to backup plan deletion error on delete to address this. but if there are selections that are not deleted for some reason (manually created or in a different module) it will just delay the error

@bflad
Copy link
Contributor

bflad commented Dec 2, 2020

A fix to shortly retry the deletion on this particular error has been merged and will release with version 3.20.0 of the Terraform AWS Provider. As mentioned above, this will only help for well-formed Terraform configurations. Thank you to @DrFaust92 for the implementation. 👍

@ghost
Copy link

ghost commented Dec 3, 2020

This has been released in version 3.20.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Jan 2, 2021

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.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Jan 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/backup Issues and PRs that pertain to the backup service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants