-
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
fix(core): top-level resources cannot use long logical ids #6419
Conversation
When allocating a logical ID for a CloudFormation resource we normally render the id by taking in the full construct path, trim it down to 240 characters and append a hash to it to make sure its unique. This technically allows construct IDs to be of any length. However, when a resource is defined as a top-level resource (i.e. the child of a stack), it won't get this treatment and we will just use the construct id as it's logical id. In this case, synthesis will fail with an error indicating the logical ID is invalid (too long). This might work ok if the logical ID is human provided, but in some cases (like #6190), the id is actually created automatically and in some cases can be longer than 255. This fix will only apply the special treatment to top-level resources if their construct ID is shorter than the maximum allowed length (255). Otherwise, it will use the same mechanism to trim them and append the hash. Fixes #6190.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request is now being automatically merged. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request is now being automatically merged. |
When allocating a logical ID for a CloudFormation resource we normally render the id by taking in the full construct path, trim it down to 240 characters and append a hash to it to make sure its unique. This technically allows construct IDs to be of any length.
However, when a resource is defined as a top-level resource (i.e. the child of a stack), it won't get this treatment and we will just use the construct id as it's logical id.
In this case, synthesis will fail with an error indicating the logical ID is invalid (too long).
This might work ok if the logical ID is human provided, but in some cases (like #6190), the id is actually created automatically and in some cases can be longer than 255.
This fix will only apply the special treatment to top-level resources if their construct ID is shorter than the maximum allowed length (255). Otherwise, it will use the same mechanism to trim them and append the hash.
Fixes #6190.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license