Skip to content

fix(core): logical IDs are not allowed to start with digits#26821

Merged
mergify[bot] merged 4 commits intoaws:mainfrom
kirkwat:main
Aug 22, 2023
Merged

fix(core): logical IDs are not allowed to start with digits#26821
mergify[bot] merged 4 commits intoaws:mainfrom
kirkwat:main

Conversation

@kirkwat
Copy link
Copy Markdown
Contributor

@kirkwat kirkwat commented Aug 21, 2023

The resource logical ID validation regex (VALID_LOGICALID_REGEX) is updated to be consistent with the CloudFormation documentation 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

@github-actions github-actions bot added the beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK label Aug 21, 2023
@aws-cdk-automation aws-cdk-automation requested a review from a team August 21, 2023 01:34
@github-actions github-actions bot added bug This issue is a bug. effort/small Small work item – less than a day of effort p2 labels Aug 21, 2023
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Aug 21, 2023

function randomAlphaNumeric() {
const alphaNumericChars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
return alphaNumericChars.charAt(Math.floor(Math.random() * 62));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to go with Math.random() * alphaNumericChars.length

@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Aug 22, 2023
}
}

function generateAlphaNumericString(chars: number) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use generateAlphaNumericString also here.

Copy link
Copy Markdown
Contributor

@lpizzinidev lpizzinidev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! 💪
Looks good overall, just a couple of minor changes on the tests should be done in my opinion.

rix0rrr
rix0rrr previously approved these changes Aug 22, 2023
@rix0rrr rix0rrr changed the title fix(core): update resource logical ID validation regex to be consistent with docs fix(core): logical IDs are not allowed to start with digits Aug 22, 2023
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Aug 22, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

1 similar comment
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Aug 22, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot dismissed rix0rrr’s stale review August 22, 2023 12:56

Pull request has been modified.

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Aug 22, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 197d363
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit 97d21a9 into aws:main Aug 22, 2023
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Aug 22, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/small Small work item – less than a day of effort p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

core: logical ID validation regex is inconsistant with cloudformation specification

4 participants