aws / aws/aws-cdk

(aws_cdk): CfnInclude does not work with conditional tags

Open
#37,734 3 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/cloudformation-include bug effort/medium p1
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

We are importing a third-party stack template that has tagged resources like so:

```yaml
Tags:
Fn::If:
- HasTags
- !GetAtt ParseTagsV2.Tags
- []
```

When using `CfnInclude` for this stack, `cdk synth` fails:

> RuntimeError: Invalid tag input expected array of {key, value} have ""

### Regression Issue

- [ ] Select this option if this issue appears to be a regression.

### Last Known Working CDK Library Version

_No response_

### Expected Behavior

CfnInclude must accept any valid stack template.

### Current Behavior

It rejects valid stack templates.

### Reproduction Steps

See above.

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### AWS CDK Library version (aws-cdk-lib)

2.250.0

### AWS CDK CLI version

2.1118.4 (build 82715b6)

### Node.js Version

11.12.1

### OS

Alpine 3.23

### Language

Python

### Language Version

Python 3.14.4

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported cdk synth failure with CfnInclude and the shown conditional Tags template, then trace how imported resource tags are processed. The issue names no repository file or test; done means a valid stack template with Fn::If-based tags is accepted and synthesizes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.