Skip to content
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

Merged
merged 7 commits into from
Nov 14, 2024
Merged

Add autonaming overlay #1828

merged 7 commits into from
Nov 14, 2024

Conversation

corymhall
Copy link
Contributor

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

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
Copy link
Contributor

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

Copy link

codecov bot commented Nov 14, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 22 lines in your changes missing coverage. Please review.

Project coverage is 49.62%. Comparing base (4872ad6) to head (1ed7447).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
provider/cmd/pulumi-gen-aws-native/main.go 33.33% 22 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

"AWS::Lambda::Function": {
"FunctionName": {
"minLength": 1,
"maxLength": 140
Copy link
Contributor

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?

Copy link
Contributor

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)

Copy link
Contributor Author

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")
Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor

@flostadler flostadler left a comment

Choose a reason for hiding this comment

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

Nice!

provider/cmd/pulumi-gen-aws-native/main_test.go Outdated Show resolved Hide resolved
@corymhall corymhall enabled auto-merge (squash) November 14, 2024 16:53
@corymhall corymhall merged commit 4111ee4 into master Nov 14, 2024
18 checks passed
@corymhall corymhall deleted the corymhall/autoname-overlays branch November 14, 2024 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants