(cli): cdk diff does not evaluate conditions
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
We have nested stacks that were imported via `cloudformation_include.CfnInclude`. Even though we have already deployed these stacks, and there have been no changes whatsoever, `cdk diff` reports a fake diff.
```
Stack [REDACTED]
Resources
[~] AWS::CloudFormation::Stack [REDACTED]/[REDACTED].NestedStack/[REDACTED].NestedStackResource [REDACTED]
└─ [~] NestedTemplate
├─ [+] Added: .AWSTemplateFormatVersion
├─ [+] Added: .Description
├─ [+] Added: .Parameters
└─ [~] .Resources:
├─ [+] Added: .[REDACTED]
├─ [+] Added: .[REDACTED]
├─ [+] Added: .[REDACTED]
├─ [+] Added: .[REDACTED]
├─ [~] .[REDACTED]:
│ ├─ [+] Added: .DependsOn
│ ├─ [+] Added: .Metadata
│ └─ [~] .Properties:
│ ├─ [~] .NestedTemplate:
│ │ ├─ [+] Added: .AWSTemplateFormatVersion
│ │ ├─ [+] Added: .Conditions
│ │ ├─ [+] Added: .Description
│ │ ├─ [+] Added: .Parameters
│ │ └─ [+] Added: .Resources
│ ├─ [+] Added: .Parameters
│ ├─ [+] Added: .Tags
│ └─ [+] Added: .TemplateURL
└─ [+] Added: .CDKMetadata
```
### Expected Behavior
There should be no diff reported if nothing has changed.
### Current Behavior
It always reports a diff for no reason.
### Reproduction Steps
Deploy nested stacks using `cloudformation_include.CfnInclude`.
Then run `cdk diff`.
### Possible Solution
_No response_
### Additional Information/Context
_No response_
### CDK CLI Version
2.28.0 (build ba233f0)
### Framework Version
_No response_
### Node.js Version
16.14.2
### OS
Alpine 3.16
### Language
Python
### Language Version
3.10.5
### Other information
_No response_
Contributor guide
Research direction
Start at the CDK CLI `cdk diff` entry point and reproduce the reported nested-stack case using Python and `cloudformation_include.CfnInclude`. Compare the diff after deployment, focusing on whether CloudFormation conditions are evaluated; done means an unchanged deployment produces no diff.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python, typescript
- Domain
- cli, cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100