aws-cdk-lib: Stack names broken after prefix changes on 2.74.0 version #25130
Labels
@aws-cdk/core
Related to core CDK functionality
aws-cdk-lib
Related to the aws-cdk-lib package
bug
This issue is a bug.
effort/medium
Medium work item – several days of effort
management/tracking
Issues that track a subject or multiple issues
p0
Please add your +1 👍 to let us know you have encountered this
Status: RESOLVED
Overview:
The CDK now attempts to deploy duplicated stacks with slight different names in some cases after changes done at https://github.com/aws/aws-cdk/pull/24443/files.
This happens because of prefixes automatically created by Stages and Stacks created within Stacks, and before the change, the prefixes were not sanitised by removeNonAllowedSpecialCharacters().
This breaking change requires huge effort in productive systems where unique resources are created within such stacks (e.g.: databases), so a fix (maybe a feature flag?) would be very much appreciated.
Workaround:
Upgrade to 2.75.1
Solution:
Reverted the PR that made the change.
Related Issues:
Original Issue:
Describe the bug
The CDK now attempts to deploy duplicated stacks with slight different names in some cases after changes done at https://github.com/aws/aws-cdk/pull/24443/files.
This happens because of prefixes automatically created by Stages and Stacks created within Stacks, and before the change, the prefixes were not sanitised by removeNonAllowedSpecialCharacters().
This breaking change requires huge effort in productive systems where unique resources are created within such stacks (e.g.: databases), so a fix (maybe a feature flag?) would be very much appreciated.
Expected Behavior
Compatibility with prefixes on stack names created previously to 2.74.0 release.
Eg.: test-AuthorizationServerStackAuthorizationServerNetworkStack
Current Behavior
Separator is removed from prefixes at removeNonAllowedSpecialCharacters().
E.g.: testAuthorizationServerStackAuthorizationServerNetworkStack
Reproduction Steps
Possible Solution
It seems to me the only possible compatible solution at this point (after 2.74.0 release) would be to introduce a feature flag/param for the stacks. Otherwise, the next version might break stacks created with stripped chars.
Additional Information/Context
This bug happens if options.prefix && components.length > 1, and prefixes contain special chars (as the dash introduced by stages).
CDK CLI Version
2.74.0
Framework Version
No response
Node.js Version
18
OS
MacOS
Language
Typescript
Language Version
No response
Other information
Issue introduced with changes from https://github.com/aws/aws-cdk/pull/24443/files which should fix #23628
The text was updated successfully, but these errors were encountered: