aws / aws/aws-cdk

aws_cdk.cloudformation_include: CfnInclude overwrites nested stack tags

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

Description

### Describe the bug

We have a CloudFormation template that defines a nested stack (AWS::CloudFormation::Stack). The template defines a few stack tags via the `Tags` section. When including this template via `aws_cdk.cloudformation_include.CfnInclude`, it overwrites these tags with the ones that are coming via `aws_cdk.Tags` in code.

### Expected Behavior

The tag lists should be merged together.

### Current Behavior

It tried to delete the tags defined in the template, as shown by `cdk diff`.

### Reproduction Steps

Define a CloudFormation template with a nested stack that has `Tags` defined. Then include that template in CDK via `aws_cdk.cloudformation_include.CfnInclude`. Set additional tags on the stack via `aws_cdk.Tags.of`. Then deploy. Observe that the nested stack is missing the tags from the template.

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### CDK CLI Version

2.28.0 (build ba233f0)

### Framework Version

_No response_

### Node.js Version

v16.15.1

### OS

Alpine 3.16

### Language

Python

### Language Version

3.10.5

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start at aws_cdk.cloudformation_include.CfnInclude and reproduce the nested AWS::CloudFormation::Stack case with template Tags plus tags applied through aws_cdk.Tags.of. Use cdk diff to inspect the generated tag changes; done means template tags are retained and additional CDK tags are merged rather than overwritten.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.