-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core: logical ID validation regex is inconsistant with cloudformation specification #26075
Comments
Thanks for reporting this, I think it's likely that CloudFormation used to have this constraint, but does not anymore. We'll see what we can do about this |
I just tried deploying through the console and CLI with a number at the beginning, and I'm getting this error:
So I think this is properly constrained by CDK |
The regex applies to stack names, however, the same regex is being used for resource names, which can have a number at the beginning. |
Thanks... don't know why I read stack ID here |
Verified you can override the logical ID to deploy successfully, we should be good to accept a PR with this |
The resource logical ID validation regex (`VALID_LOGICALID_REGEX`) is updated to be consistent with the [CloudFormation documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resources-section-structure.html) which says that logical IDs are alphanumeric. Closes #26075. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
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
The text was updated successfully, but these errors were encountered: