(diff): let `cdk diff` show nested templates also with --template
- Dominant language
- TypeScript
- Stars
- 105
- Forks
- 122
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 71
Description
### Describe the feature
With aws/aws-cdk#18207 the CLI command `cdk diff` got support for showing changes to nested templates when comparing against a deployment. It would be nice if we could use the same feature also when comparing against a synthesized template with `--template``
### Use Case
In our CI/CD pipeline we want to show the changes a PR causes to the template. For this, we compare the synthesized template against the one synthesized from the base branch (using something like `cdk diff --template cdk-base.out/MyStack.template --app cdk.out --exclusively MyStack`).
Unfortunately this does not show information about nested stacks except that their template has changed.
Comparing against deployment is not a viable solution, because the base branch often already contains other changes that have not yet been deployed, which would then also show up in the diff, even though they are completely unrelated.
### Proposed Solution
A possible solution could be to let `--template` specify a directory (usually `cdk.out`), not only a single template. The diff algorithm would then pick up the nested stack templates and add them to the parent diff.
This would perhaps also remove the necessity to use `--exclusively` to ensure only a single stack is compared.
### Other Information
_No response_
### Acknowledgements
- [X] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### CDK version used
2.54.0
### Environment details (OS name and version, etc.)
Ubuntu 22.04.1 (via Windows WSL)
Contributor guide
Assessment
This issue has not been assessed yet.