Describe the bug
The CloudFormation documentation indicates that logical ID's must be only alphanumeric, yet the regex in the logical ID validation file is /^[A-Za-z][A-Za-z0-9]{1,254}$/. This causes logical IDs such as 030ffab42b5f448fb39750B452 to fail even though they are valid according to the CloudFormation standard.
Expected Behavior
Logical IDs such as 030ffab42b5f448fb39750B452 to be considered valid to the CDK when synthesizing a stack
Current Behavior
Logical IDs such as 030ffab42b5f448fb39750B452 are not considered valid when synthesizing a stack.
Error: Resolution error: Logical ID must adhere to the regular expression: /^[A-Za-z][A-Za-z0-9]{1,254}$/, got '030ffab42b5f448fb39750B452'.
Reproduction Steps
- initialize sample cdk app
- in the stack, add the following code:
import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
import * as sqs from 'aws-cdk-lib/aws-sqs';
export class CdkErrorTestStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
// The code that defines your stack goes here
// example resource
const queue = new sqs.Queue(this, '030ffab42b5f448fb39750B452', {
visibilityTimeout: cdk.Duration.seconds(300)
});
}
}
run cdk synth
Possible Solution
Change the logical ID validation regex to fit CloudFormation documentation, or change the documentation to reflect the regex validation.
Additional Information/Context
No response
CDK CLI Version
2.85.0 (build 4e0d726)
Framework Version
No response
Node.js Version
v14.21.3
OS
Linux
Language
Typescript
Language Version
No response
Other information
No response
Describe the bug
The CloudFormation documentation indicates that logical ID's must be only alphanumeric, yet the regex in the logical ID validation file is /^[A-Za-z][A-Za-z0-9]{1,254}$/. This causes logical IDs such as 030ffab42b5f448fb39750B452 to fail even though they are valid according to the CloudFormation standard.
Expected Behavior
Logical IDs such as 030ffab42b5f448fb39750B452 to be considered valid to the CDK when synthesizing a stack
Current Behavior
Logical IDs such as 030ffab42b5f448fb39750B452 are not considered valid when synthesizing a stack.
Error: Resolution error: Logical ID must adhere to the regular expression: /^[A-Za-z][A-Za-z0-9]{1,254}$/, got '030ffab42b5f448fb39750B452'.
Reproduction Steps
run cdk synth
Possible Solution
Change the logical ID validation regex to fit CloudFormation documentation, or change the documentation to reflect the regex validation.
Additional Information/Context
No response
CDK CLI Version
2.85.0 (build 4e0d726)
Framework Version
No response
Node.js Version
v14.21.3
OS
Linux
Language
Typescript
Language Version
No response
Other information
No response