Skip to content

fix(globalaccelerator): parameter name can exceed limit of 64 characters#24796

Merged
mergify[bot] merged 4 commits intoaws:mainfrom
lpizzinidev:gh-24325
Apr 4, 2023
Merged

fix(globalaccelerator): parameter name can exceed limit of 64 characters#24796
mergify[bot] merged 4 commits intoaws:mainfrom
lpizzinidev:gh-24325

Conversation

@lpizzinidev
Copy link
Copy Markdown
Contributor

@lpizzinidev lpizzinidev commented Mar 27, 2023

The global accelerator should automatically generate a Name with a length smaller than 64 characters if the acceleratorName property is not specified, otherwise, it will fail during synth.
If acceleratorName is specified, it should validate its length to be in the expected range (1-64 characters).

Closes #24325.


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 repeat-contributor [Pilot] contributed between 3-5 PRs to the CDK label Mar 27, 2023
@aws-cdk-automation aws-cdk-automation requested a review from a team March 27, 2023 08:50
@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 Mar 27, 2023
@lpizzinidev lpizzinidev changed the title fix(globalaccelerator): parameter name can exceed limit of 64 characters fix(globalaccelerator): parameter name can exceed limit of 64 characters (under feature flag) Mar 27, 2023
Copy link
Copy Markdown
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! Overall, this looks great. Please see my comments inline.

separator: '-',
maxLength: maxResourceNameLength,
allowedSpecialCharacters: '/_-',
}) : props.acceleratorName ?? cdk.Names.uniqueId(this);
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'll still have a problem here if acceleratorName is longer than 64 characters. I'm not seeing anywhere that we validate the length of it. We should probably add that to this change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Should I trim the length automatically(props.acceleratorName ?? cdk.Names.uniqueId(this)).slice(-64); or check the value and throw an error in case it exceeds the character limit?

super(scope, id);

const maxResourceNameLength = 64;
const name = cdk.FeatureFlags.of(this).isEnabled(cxapi.GLOBAL_ACCELERATOR_SAFE_RESOURCE_NAME) ?
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.

Because this isn't used on a stateful resource, I'm not actually sure we need the feature flag here. Checking in with other team members on this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, let me know. I've added the feature flag because the issue is similar to this one, where a feature flag was requested.

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.

I've verified that we don't need the feature flag here (or in the linked one).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've removed the FF.
Once this has been reviewed and accepted I will align the other PR as well.

@lpizzinidev lpizzinidev changed the title fix(globalaccelerator): parameter name can exceed limit of 64 characters (under feature flag) fix(globalaccelerator): parameter name can exceed limit of 64 characters Mar 30, 2023
@mergify mergify Bot dismissed TheRealAmazonKendra’s stale review March 30, 2023 09:04

Pull request has been modified.

Copy link
Copy Markdown
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

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

Looks like there are a few issues to resolve. Our restructure caused some conflicts but also the build failed due to the integ test needing to be updated.

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

1 similar comment
@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

@mergify mergify Bot dismissed TheRealAmazonKendra’s stale review April 4, 2023 07:15

Pull request has been modified.

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 4, 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: 3bb4486
  • 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 334dc80 into aws:main Apr 4, 2023
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 4, 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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aws-cdk-lib.aws_globalaccelerator: Name attribute not generated according to rules

3 participants