Skip to content

fix(toolkit-lib): report termination protection changes during deploy - #2173

Merged
mrgrain merged 1 commit into
aws:mainfrom
azatoth:fix/report-termination-protection-change
Nov 26, 2026
Merged

mrgrain merged 1 commit into
aws:mainfrom
azatoth:fix/report-termination-protection-change

Conversation

@azatoth

@azatoth azatoth commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Relates to aws/aws-cdk#32043 (filed in aws/aws-cdk before the CLI moved here). This PR covers deploy, and the diff side is #2174, which will close the issue.

When a deployment changes only the stack's termination protection, CloudFormation creates an empty change set. The deploy then reports ✅ MyStack (no changes), even though UpdateTerminationProtection was called. The only trace of that call was a debug-level log line, so nothing in the normal output said what changed.

This PR reports the update at info level:

MyStack: termination protection enabled
✅  MyStack (no changes)

noOp is unchanged

One option was to return noOp: false in this case. I decided against it: Deployments.prepareStack() and the deploy loop in Toolkit.deploy() / CdkToolkit.deploy() use noOp to mean "there is no change set to execute". With noOp: false, an empty prepared change set is no longer final, and deploy would go through a second, executing pass. noOp still means "CloudFormation had nothing to do", and the termination protection change gets its own message.

Out of scope: termination protection is changed before approval

updateTerminationProtection() runs in the change-set path even when execute: false. For an executing deploy, the first phase is prepareStack(), so termination protection is already updated before the approval prompt is shown. Declining the prompt doesn't undo it. Changing that would also change --no-execute behaviour, so I left it for a separate discussion.

The diff side (showing the change in cdk diff) is a separate PR.

Checklist

  • Unit tests added
  • No manual edits to generated files

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

🤖 Generated with Claude Code

@azatoth
azatoth requested a review from a team November 22, 2026 11:12
@github-actions github-actions Bot added the p2 label Nov 22, 2026
auto-merge was automatically disabled November 24, 2026 07:43

Head branch was pushed to by a user without write access

@azatoth
azatoth force-pushed the fix/report-termination-protection-change branch from 508ad7f to d69365b Compare November 24, 2026 07:43
When a deployment changes only the stack's termination protection, the
change set is empty and the deploy reports "(no changes)", while the
termination protection update itself was only logged at debug level.
Report the update at info level so the user can see what changed.

Refs aws/aws-cdk#32043

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@azatoth
azatoth force-pushed the fix/report-termination-protection-change branch from d69365b to 46c4303 Compare November 26, 2026 07:46
@azatoth
azatoth deployed to integ-approval November 26, 2026 07:46 — with GitHub Actions Active
@mrgrain
mrgrain enabled auto-merge November 26, 2026 09:40
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.52%. Comparing base (db0009f) to head (46c4303).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2173   +/-   ##
=======================================
  Coverage   92.52%   92.52%           
=======================================
  Files          81       81           
  Lines       13224    13224           
  Branches     1915     1915           
=======================================
  Hits        12236    12236           
  Misses        950      950           
  Partials       38       38           
Flag Coverage Δ
suite.unit 92.52% <ø> (ø)

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.

@mrgrain
mrgrain added this pull request to the merge queue Nov 26, 2026
Merged via the queue into aws:main with commit b5defc9 Nov 26, 2026
81 of 84 checks passed

This branch was successfully deployed

1 active and 2 inactive (1 outdated) deployments
run-tests — 46c43031 Deployed Nov 26, 2026 by azatoth via integ_cli (cli-integ-tests, 24.19, 10) #7799
integ-approval — 46c43031 Deployed Nov 26, 2026 by azatoth via prepare #7799
automation — 508ad7f9 Deployed Nov 22, 2026 by azatoth via Set AutoQueue on PR #2173 #4030
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.

3 participants