aws-cdk
aws-cdk copied to clipboard
fix(cdk): `cdk diff --quiet` to print stack name when there is diffs
Issue # (if applicable)
Closes #27128
Reason for this change
The --quiet flag on the cdk diff command prevents the stack name and default message from being printed when no diff exists.
If diffs exist, the stack name and diffs are expected to be printed, but currently, the stack name is not printed, and it is difficult to determine which stack the diff is for.
for example:
$ cdk diff --quiet
Resources
[~] AWS::S3::Bucket MyFirstBucket MyFirstBucketB8884501
├─ [~] DeletionPolicy
│ ├─ [-] Delete
│ └─ [+] Retain
└─ [~] UpdateReplacePolicy
├─ [-] Delete
└─ [+] Retain
✨ Number of stacks with differences: 1
This PR will fix to print the stack name when the --quiet flag is specified and diffs exist.
Description of changes
Changed the position of the fullDiff function call.
It is possible to output the stack name in the printSecurityDiff or printStackDiff functions, but since the message has already been output before these functions are called, the stack name must be output first.
I think it would be more user-friendly to have all messages after the output of the stack name, but if this is not the case, please point this out.
Description of how you validated changes
I added a unit test to confirm to print the stack name when diff exists.
Checklist
- [x] My code adheres to the CONTRIBUTING GUIDE and DESIGN GUIDELINES
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
Exemption Request: I think the unit tests cover the test for this change.
This PR has been in the CHANGES REQUESTED state for 3 weeks, and looks abandoned. To keep this PR from being closed, please continue work on it. If not, it will automatically be closed in a week.
@comcalvi I have modified the code and added a test for nested stacks, could you review it again?
Is there any update on this PR?
How can we grab the attention of someone who can review this?
:arrow_right: PR build request submitted to test-main-pipeline :arrow_left:
A maintainer must now check the pipeline and add the pr-linter/cli-integ-tested label once the pipeline succeeds.
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).
AWS CodeBuild CI Report
- CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
- Commit ID: 092fc2a0ceb7796649c717399e3402806d01eb98
- Result: SUCCEEDED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).
Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.