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

CloudFormation: Allow deletion of deeply nested structures #7413

Conversation

bblommers
Copy link
Collaborator

Scenario: Resource A depends on resource B

When CloudFormation tries to delete both resources, it will do so in an unspecified order.
If CF tries to delete resource B first, it will fail because A depends on it
CloudFormation continues with the deletion of resource A (and any other unrelated resources)

Because B is not yet deleted, CF will iterate over the remaining resources. Nothing depends on resource B anymore, so it will be deleted successfully.

This was already implemented, but with the caveat that we would only iterate over the list of remaining resources up to 5 times.

With this change, we will iterate as long as we are deleting some resources per iteration, i.e.: there is some progression. This has two benefits:

  • Deletion of resources with a chain of 5 or more dependencies should now be successful (as we just keep retrying until everything is gone)
  • If the deletion of a resource will never work, for whatever reason, we don't need to retry 5 times. Moto now immediately realizes that we haven't been able to delete any resources, and stop processing.

Related: #7381

@bblommers bblommers added this to the 5.0.3 milestone Mar 1, 2024
@bblommers bblommers force-pushed the cf-allow-deleting-deeply-nested-structures branch from dcfa26a to 7f620e9 Compare March 1, 2024 21:38
Copy link

codecov bot commented Mar 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.77%. Comparing base (9aef694) to head (7f620e9).
Report is 63 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7413      +/-   ##
==========================================
- Coverage   95.88%   95.77%   -0.11%     
==========================================
  Files         843      843              
  Lines       82578    83096     +518     
==========================================
+ Hits        79178    79589     +411     
- Misses       3400     3507     +107     
Flag Coverage Δ
servertests 32.49% <0.00%> (-0.03%) ⬇️
unittests 95.74% <100.00%> (-0.11%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bblommers bblommers merged commit cd40abe into getmoto:master Mar 1, 2024
39 checks passed
@bblommers bblommers deleted the cf-allow-deleting-deeply-nested-structures branch March 1, 2024 22:04
Copy link
Contributor

github-actions bot commented Mar 1, 2024

This is now part of moto >= 5.0.3.dev34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant