diff --git a/packages/aws-cdk-lib/aws-stepfunctions/lib/states/distributed-map.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/states/distributed-map.ts index 89453f316aebe..00c24e02165e8 100644 --- a/packages/aws-cdk-lib/aws-stepfunctions/lib/states/distributed-map.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/lib/states/distributed-map.ts @@ -172,7 +172,7 @@ export class DistributedMap extends MapBase implements INextable { errors.push('label must be 40 characters or less'); } - let labelRegex = new RegExp('[\s\?\*\<\>\{\}\\[\\]\:\;\,\\\|\^\~\$\#\%\&\`\"]|[\u0000-\u001f]|[\u007f-\u009f]', 'gi'); + let labelRegex = /[\s\?\*\<\>\{\}\\[\]\:\;\,\|\^\~\$\#\%\&\`\"]|[\u0000-\u001f]|[\u007f-\u009f]/gi; if (labelRegex.test(this.label)) { errors.push('label cannot contain any whitespace or special characters'); } diff --git a/packages/aws-cdk-lib/aws-stepfunctions/test/distributed-map.test.ts b/packages/aws-cdk-lib/aws-stepfunctions/test/distributed-map.test.ts index e9ee37d453d59..56795af26cbd3 100644 --- a/packages/aws-cdk-lib/aws-stepfunctions/test/distributed-map.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/test/distributed-map.test.ts @@ -765,6 +765,19 @@ describe('Distributed Map State', () => { expect(() => app.synth()).toThrow(/label cannot contain any whitespace or special characters/); }); + + test('does not fail in synthesis if label has `s`', () => { + const app = createAppWithMap((stack) => { + const map = new stepfunctions.DistributedMap(stack, 'Map State', { + label: 's', + itemsPath: stepfunctions.JsonPath.stringAt('$.inputForMap'), + }); + + return map; + }); + + app.synth(); + }); }); function render(sm: stepfunctions.IChainable) { @@ -777,4 +790,4 @@ function createAppWithMap(mapFactory: (stack: cdk.Stack) => stepfunctions.Distri const map = mapFactory(stack); new stepfunctions.StateGraph(map, 'Test Graph'); return app; -} \ No newline at end of file +}