Skip to content

fix(cloudformation-diff): classify retained removals as orphaned - #1890

Merged
aws-cdk-automation merged 1 commit into
aws:mainfrom
nanookclaw:fix/retain-except-on-create-impact
Aug 25, 2026
Merged

fix(cloudformation-diff): classify retained removals as orphaned#1890
aws-cdk-automation merged 1 commit into
aws:mainfrom
nanookclaw:fix/retain-except-on-create-impact

Conversation

@nanookclaw

@nanookclaw nanookclaw commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Fixes #1882

ResourceDifference.changeImpact currently treats removed resources with DeletionPolicy: RetainExceptOnCreate as WILL_DESTROY. For a resource that already exists and is removed from a template, CloudFormation retains it under this policy, just as it does with Retain.

This changes removal classification to return WILL_ORPHAN for both Retain and RetainExceptOnCreate. Existing no-policy/Delete behavior remains WILL_DESTROY; Snapshot behavior is unchanged, leaving that separate API decision to maintainers.

The existing deletion-impact test is parameterized to cover both retention policies while retaining no-policy coverage.

Validation:

  • git diff --check
  • Focused Jest test could not run locally: Yarn is not installed, and Corepack could not download the repository's pinned Yarn version because repo.yarnpkg.com was unavailable (EAI_AGAIN).

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@mrgrain

mrgrain commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Nice one, thank you!

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.34%. Comparing base (ca8a14a) to head (129f33b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1890      +/-   ##
==========================================
- Coverage   91.38%   91.34%   -0.04%     
==========================================
  Files          80       80              
  Lines       12264    12264              
  Branches     1747     1745       -2     
==========================================
- Hits        11207    11203       -4     
- Misses       1021     1025       +4     
  Partials       36       36              
Flag Coverage Δ
suite.unit 91.34% <ø> (-0.04%) ⬇️

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

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aws-cdk-automation
aws-cdk-automation added this pull request to the merge queue Aug 25, 2026
Merged via the queue into aws:main with commit 659a083 Aug 25, 2026
50 of 51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(cloudformation-diff): changeImpact reports WILL_DESTROY for removals with DeletionPolicy RetainExceptOnCreate (and Snapshot)

4 participants