feat(cloudfront): associate key value stores to functions#28571
feat(cloudfront): associate key value stores to functions#28571mergify[bot] merged 9 commits intoaws:mainfrom
Conversation
aws-cdk-automation
left a comment
There was a problem hiding this comment.
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
go-to-k
left a comment
There was a problem hiding this comment.
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.
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.
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.
OK, I agree. Let's go ahead with this.
Co-authored-by: k.goto <24818752+go-to-k@users.noreply.github.com>
gracelu0
left a comment
There was a problem hiding this comment.
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
KeyValueStoreAssocationson 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.0instead 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