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
test('Should not modify stage prefix', () => {
// WHEN
const app = new App();
new MyStage(app, 'test');
let result = app.synth();
console.log(result);
});
class MyStage extends Stage {
constructor(scope: Construct, id: string) {
super(scope, id);
new AuthorizationServerStack(this, 'AuthorizationServerStack', {
stackName: 'AuthorizationServerStack'
});
}
}
class AuthorizationServerStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
let bogusStack = new BogusStack(this, 'AuthorizationServerNetworkStack');
// THEN
expect(bogusStack.stackName).toEqual('test-AuthorizationServerStackAuthorizationServerNetworkStack');
}
}
class BogusStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
new CfnResource(this, 'Resource', {
type: 'CDK::Test::Resource',
});
}
}
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
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