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

Change NoValue psuedo-parameters to references #160

Merged
merged 1 commit into from
Dec 30, 2023

Conversation

troyready
Copy link
Contributor

@troyready troyready commented Dec 30, 2023

Description of changes:

This changes the instances of the NoValue pseudo-parameter to use the Ref intrinsic function, so that the key is omitted instead of the literal string AWS::NoValue being used.

Without this change, attempting to deploy the stack without a specified FunctionName results in an error:

Resource handler returned message: "1 validation error detected: Value 'AWS::NoValue' at 'functionName' failed to satisfy constraint: Member must satisfy regular expression pattern: (arn:(aws[a-zA-Z-]*)?:lambda:)?([a-z]{2}((-gov)|(-iso(b?)))?-[a-z]+-\d{1}:)?(\d{12}:)?(function:)?([a-zA-Z0-9-_\.]+)(:(\$LATEST|[a-zA-Z0-9-_]+))? (Service: Lambda, Status Code: 400, Request ID: UUID)" (RequestToken: UUID, HandlerErrorCode: GeneralServiceException)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

This changes the instances of the [NoValue pseudo-parameter](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/pseudo-parameter-reference.html) to use the [Ref intrinsic function](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html), so that the key is omitted instead of the literal string `` being used.

Without this change, attempting to deploy the stack without a specified FunctionName results in an error:

```
Resource handler returned message: "1 validation error detected: Value 'AWS::NoValue' at 'functionName' failed to satisfy constraint: Member must satisfy regular expression pattern: (arn:(aws[a-zA-Z-]*)?:lambda:)?([a-z]{2}((-gov)|(-iso(b?)))?-[a-z]+-\d{1}:)?(\d{12}:)?(function:)?([a-zA-Z0-9-_\.]+)(:(\$LATEST|[a-zA-Z0-9-_]+))? (Service: Lambda, Status Code: 400, Request ID: UUID)" (RequestToken: UUID, HandlerErrorCode: GeneralServiceException)
```
@ChrisPates
Copy link
Contributor

ChrisPates commented Dec 30, 2023 via email

@ChrisPates
Copy link
Contributor

ChrisPates commented Dec 30, 2023 via email

@troyready
Copy link
Contributor Author

@ChrisPates Thanks for the prompt feedback.

I don't think I was clear enough in the description: this isn't a regex issue, that's just the error that comes up.

Any user omitting the FunctionName parameter (that's what I was attempting to do) will experience this error, because the condition on the name parameter for the function resource has a bad "else" value -- instead of allowing the name to be automatically generated it tries to pass the name AWS::NoValue.

Copy link
Contributor

@ChrisPates ChrisPates left a comment

Choose a reason for hiding this comment

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

Looks good.

@ChrisPates ChrisPates merged commit b819bc8 into awslabs:master Dec 30, 2023
1 check passed
@troyready troyready deleted the patch-1 branch December 30, 2023 19:26
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