Skip to content

CFNV2: defer deletions for correcting deploy order #12936

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

Merged
merged 39 commits into from
Aug 5, 2025
Merged

Conversation

simonrw
Copy link
Contributor

@simonrw simonrw commented Jul 30, 2025

Motivation

CloudFormation ensures that resources that require replacement are deleted once the new stack state is fully deployed. It also removes resources in reverse order of their dependency chain.

Changes

  • Introduce the concept of "deferred actions" which are run once the stack has finished its "constructive" operations
  • Unskip test_stack_deploy_order
  • Add new test for testing the deletion ordering which captures resource state changes and their ordering

@simonrw simonrw added the semver: patch Non-breaking changes which can be included in patch releases label Jul 30, 2025
Copy link

github-actions bot commented Jul 30, 2025

Test Results - Preflight, Unit

22 063 tests  ±0   20 329 ✅ ±0   6m 29s ⏱️ +7s
     1 suites ±0    1 734 💤 ±0 
     1 files   ±0        0 ❌ ±0 

Results for commit 1668517. ± Comparison against base commit 7015841.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jul 30, 2025

Test Results (amd64) - Acceptance

7 tests  ±0   5 ✅ ±0   3m 11s ⏱️ +4s
1 suites ±0   2 💤 ±0 
1 files   ±0   0 ❌ ±0 

Results for commit 1668517. ± Comparison against base commit 7015841.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jul 30, 2025

LocalStack Community integration with Pro

    2 files  ±0      2 suites  ±0   1h 44m 12s ⏱️ + 2m 18s
4 589 tests +3  4 176 ✅ ±0  413 💤 +3  0 ❌ ±0 
4 591 runs  +3  4 176 ✅ ±0  415 💤 +3  0 ❌ ±0 

Results for commit 87d33ca. ± Comparison against base commit 9dd048c.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jul 30, 2025

Test Results (amd64) - Integration, Bootstrap

    5 files      5 suites   2h 21m 36s ⏱️
4 948 tests 4 383 ✅ 565 💤 0 ❌
4 954 runs  4 383 ✅ 571 💤 0 ❌

Results for commit 87d33ca.

♻️ This comment has been updated with latest results.

@coveralls
Copy link

coveralls commented Jul 30, 2025

Coverage Status

coverage: 66.353% (+15.0%) from 51.395%
when pulling 6666cde on cfn/v2/deletion-order
into 476e7f3 on main.

@simonrw simonrw marked this pull request as ready for review July 31, 2025 11:56
@pinzon
Copy link
Member

pinzon commented Jul 31, 2025

@simonrw we should convert this PR to a draft for now

@simonrw simonrw marked this pull request as draft August 1, 2025 10:29
@simonrw simonrw changed the base branch from main to cfn/v2/merge-tests August 1, 2025 12:26
@simonrw simonrw force-pushed the cfn/v2/deletion-order branch from 6666cde to bb135e7 Compare August 1, 2025 12:26
Base automatically changed from cfn/v2/merge-tests to main August 1, 2025 14:00
@simonrw simonrw force-pushed the cfn/v2/deletion-order branch from bb135e7 to 21bf39b Compare August 1, 2025 14:02
@simonrw simonrw marked this pull request as ready for review August 1, 2025 14:56
Copy link
Member

@pinzon pinzon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for implementing this 👍

# perform all deferred actions such as deletions. These must happen in reverse from their
# defined order so that resource dependencies are honoured
# TODO: errors will stop all rollbacks; get parity on this behaviour
for action in self._deferred_actions[::-1]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Consider setting the stack status to UPDATE_COMPLETE_CLEANUP_IN_PROGRESS when the deferred actions are being executed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great idea, thanks @pinzon !

@simonrw simonrw marked this pull request as draft August 2, 2025 21:37
@simonrw simonrw force-pushed the cfn/v2/deletion-order branch from d87da8e to 87d33ca Compare August 4, 2025 22:15
@simonrw simonrw marked this pull request as ready for review August 5, 2025 16:39
@simonrw simonrw merged commit e62a727 into main Aug 5, 2025
35 of 37 checks passed
@simonrw simonrw deleted the cfn/v2/deletion-order branch August 5, 2025 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants