-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
feat(cloudfront): associate key value stores to functions #28571
Conversation
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.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
@Mergifyio update |
✅ Branch has been successfully updated |
971bb05
to
8728e41
Compare
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.
Thanks for this PR! I made a few comments.
|
||
test('no value is used in CloudFormation when unspecified in CDK', () => { | ||
const stack = new Stack(); | ||
|
||
new Function(stack, 'TestFn', { | ||
code: FunctionCode.fromInline('code'), | ||
runtime: FunctionRuntime.JS_2_0, | ||
keyValueStore: undefined, | ||
}); | ||
|
||
Template.fromStack(stack).hasResourceProperties('AWS::CloudFront::Function', { | ||
FunctionConfig: { | ||
KeyValueStoreAssociations: Match.absent(), | ||
}, | ||
}); | ||
}); | ||
}); |
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 don't see much need for this, but what do you think? (unless you intend to make sure that it is not generated with an empty array, or something like that.)
test('no value is used in CloudFormation when unspecified in CDK', () => { | |
const stack = new Stack(); | |
new Function(stack, 'TestFn', { | |
code: FunctionCode.fromInline('code'), | |
runtime: FunctionRuntime.JS_2_0, | |
keyValueStore: undefined, | |
}); | |
Template.fromStack(stack).hasResourceProperties('AWS::CloudFront::Function', { | |
FunctionConfig: { | |
KeyValueStoreAssociations: Match.absent(), | |
}, | |
}); | |
}); | |
}); |
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 I like it being explicit that it should be left absent instead of perhaps an empty list. I agree it's perhaps covered by other cases or less critical but it does feel like an important way to preserve the correct behavior at a CloudFormation layer.
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.
OK, I agree. Let's go ahead with this.
Co-authored-by: k.goto <24818752+go-to-k@users.noreply.github.com>
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.
Looks good.
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.
Thank you for contributing! Left a tiny comment but otherwise LGTM :)
...sting/framework-integ/test/aws-cloudfront/test/integ.function-key-value-store-association.ts
Outdated
Show resolved
Hide resolved
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
CloudFormation now supports specifying [`KeyValueStoreAssocations`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-function-keyvaluestoreassociation.html) on a `AWS::CloudFront::Function`. This adds that support to the CDK. Even though the field is plural (in CloudFormation and the API), [a function can have one value store](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/kvs-with-functions-associate.html) so the implementation here tries to provide a nicer API around that. If a Key Value Store is specified, the function will default to `js-2.0` instead of `js-1.0`. Behavior for existing functions is retained. Additionally, an error is thrown if 1.0 is used. Closes aws#28377. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
CloudFormation now supports specifying [`KeyValueStoreAssocations`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-function-keyvaluestoreassociation.html) on a `AWS::CloudFront::Function`. This adds that support to the CDK. Even though the field is plural (in CloudFormation and the API), [a function can have one value store](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/kvs-with-functions-associate.html) so the implementation here tries to provide a nicer API around that. If a Key Value Store is specified, the function will default to `js-2.0` instead of `js-1.0`. Behavior for existing functions is retained. Additionally, an error is thrown if 1.0 is used. Closes #28377. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
CloudFormation now supports specifying
KeyValueStoreAssocations
on aAWS::CloudFront::Function
. This adds that support to the CDK. Even though the field is plural (in CloudFormation and the API), a function can have one value store so the implementation here tries to provide a nicer API around that.If a Key Value Store is specified, the function will default to
js-2.0
instead ofjs-1.0
. Behavior for existing functions is retained. Additionally, an error is thrown if 1.0 is used.Closes #28377.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license