-
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
aws-cdk-lib.aws_globalaccelerator: Name attribute not generated according to rules #24325
Comments
Thank you for your report. Yes you are right we should use |
…ers (#24796) 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*
|
Describe the bug
It seems that the Accelerator "Name" attribute is generated incorrectly and cause errors that prevent the creation of the accelerator if the automatically generated name is too long.
Expected Behavior
I expected the resource to be created successfully and with a compliant name.
Current Behavior
The error message returned was:
Reproduction Steps
I have a stack named
ZpayGlobalSyteCentral-Stack
and an accelerator namedAccelerator
.The generated unique name is 68 characters long, where as 64 characters is the limit for a GlobalAccelerator name.
Possible Solution
It seems that the current name is generated by
cdk.Names.uniqueId
:aws-cdk/packages/@aws-cdk/aws-globalaccelerator/lib/accelerator.ts
Line 90 in 539d036
This is incorrect to generate a resource name, as explained by the documentation. Instead, the generation should happen via
cdk.Names.uniqueResourceName
:Above code is not tested and is not a significant contribution from me, so can be used freely and without attribution.
Additional Information/Context
https://i.imgur.com/MS1ysj0.mp4
CDK CLI Version
2.66.0 (build c96c17d)
Framework Version
No response
Node.js Version
v19.5.0
OS
Linux codespaces-af5ba0 5.4.0-1103-azure #109~18.04.1-Ubuntu SMP Wed Jan 25 20:53:00 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Language
Typescript
Language Version
4.9.5
Other information
No response
The text was updated successfully, but these errors were encountered: