-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add autonaming overlay #1828
Add autonaming overlay #1828
Conversation
Most resources have some limits on what the resource name can be. Unfortunately a lot of those limits are not currently stored in the CloudFormation schema. This PR introduces a new schema overlay where we can manually store min/max length constraints for resource names. This is the first step in addressing #1816. I will follow this up with another PR to trim names to fit within the constraints. re #1816, re pulumi/pulumi-cdk#62
Does the PR have any schema changes?Looking good! No breaking changes found. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1828 +/- ##
==========================================
- Coverage 49.67% 49.62% -0.06%
==========================================
Files 43 43
Lines 6562 6591 +29
==========================================
+ Hits 3260 3271 +11
- Misses 3059 3077 +18
Partials 243 243 ☔ View full report in Codecov by Sentry. |
aws-cfn-autoname-overlay.json
Outdated
"AWS::Lambda::Function": { | ||
"FunctionName": { | ||
"minLength": 1, | ||
"maxLength": 140 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this one is tricky. For auto naming we want 64 because the max length is only 140 if you use a ARN/partial ARN. Otherwise it's 64.
Does the maxLength apply to auto naming only or also for validating the name property if it's set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But to be honest. I have no clue why somebody would use the ARN or partial ARN when creating a function (or why Lambda supports that)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow good catch! We want 64 here since this will only be used in creating an auto name.
Stderr: &buf, | ||
ExpectFailure: true, | ||
ExtraRuntimeValidation: func(t *testing.T, stackInfo integration.RuntimeValidationStackInfo) { | ||
assert.Contains(t, buf.String(), "is too large to fix max length constraint of 64") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of scope, but shouldn't the error message here be "... too large to fit max length constraint". Maybe it's a non-native speaker issue on my end.
I can cut a PR if we think this is wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I think it was just a typo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Co-authored-by: Florian Stadler <[email protected]>
Most resources have some limits on what the resource name can be.
Unfortunately a lot of those limits are not currently stored in the
CloudFormation schema.
This PR introduces a new schema overlay where we can manually store
min/max length constraints for resource names.
This is the first step in addressing #1816. I will follow this up with
another PR to trim names to fit within the constraints.
re #1816, re pulumi/pulumi-cdk#62