aws / aws/aws-cdk

(core & cloudformation-include): Tags are autosorted by default, causing issues when adopting an older stack

Open
#21,474 8 comments 9 reactions 0 assignees View on GitHub
@aws-cdk/cloudformation-include bug effort/small p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
1d 19h
Merged PRs (30d)
74

Description

### Describe the feature

Tags are automatically sorted which causes an undeployable setup if using https://github.com/aws/aws-cdk/tree/main/packages/@aws-cdk/cloudformation-include for a big sized CloudFormation stack.

The place of evil: https://github.com/aws/aws-cdk/blob/main/packages/@aws-cdk/core/lib/tag-manager.ts#L413

### Use Case

Currently when you want to use the cloudformation-include package to adopt a legacy big stack CDK just craps out because CDK is trying to sort the tags of the stack, which it shouldn't do for this case.

### Proposed Solution

There should be a feature flag when using `CfnInclude` from the cloudformation-include package to NOT try to sort the tags.

### 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

1.167.0

### Environment details (OS name and version, etc.)

Windows 10

Contributor guide

Open the contributing guide

Research direction

Start with packages/@aws-cdk/core/lib/tag-manager.ts around line 413 and trace how CfnInclude from packages/@aws-cdk/cloudformation-include processes tags. Determine where a CfnInclude-specific option or feature flag could prevent tag sorting without changing other stack behavior. Done means a legacy large stack can be adopted without tag reordering while normal tag handling remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.