Skip to content

Commit 373bcdd

Browse files
go-to-kyashkh-amzn
authored andcommitted
feat(cloudfront): support gRPC for distribution (aws#32535)
### Issue # (if applicable) Closes aws#32534. ### Reason for this change CloudFormation supports `GrpcConfig` property to enable gRPC in `CacheBehavior` and `DefaultCacheBehavior`. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-grpcconfig.html https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html So it would be good to enable gRPC for CloudFront Distribution using L2. ### Description of changes Add `enableGrpc` property in `BehaviorOptions`. ### Description of how you validated changes Both unit and integ tests. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 7b1a847 commit 373bcdd

14 files changed

+727
-5
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-grpc.js.snapshot/DistributionGrpcDefaultTestDeployAssertE740300C.assets.json

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-grpc.js.snapshot/DistributionGrpcDefaultTestDeployAssertE740300C.template.json

+36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-grpc.js.snapshot/cdk.out

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-grpc.js.snapshot/integ-distribution-grpc.assets.json

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
{
2+
"Resources": {
3+
"TestDistribution94EC811C": {
4+
"Type": "AWS::CloudFront::Distribution",
5+
"Properties": {
6+
"DistributionConfig": {
7+
"CacheBehaviors": [
8+
{
9+
"CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e58f6",
10+
"Compress": true,
11+
"PathPattern": "/second",
12+
"TargetOriginId": "integdistributiongrpcTestDistributionOrigin1C4AE5CE4",
13+
"ViewerProtocolPolicy": "allow-all"
14+
},
15+
{
16+
"CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e58f6",
17+
"Compress": true,
18+
"PathPattern": "/third",
19+
"TargetOriginId": "integdistributiongrpcTestDistributionOrigin1C4AE5CE4",
20+
"ViewerProtocolPolicy": "allow-all"
21+
}
22+
],
23+
"DefaultCacheBehavior": {
24+
"AllowedMethods": [
25+
"GET",
26+
"HEAD",
27+
"OPTIONS",
28+
"PUT",
29+
"PATCH",
30+
"POST",
31+
"DELETE"
32+
],
33+
"CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e58f6",
34+
"Compress": true,
35+
"GrpcConfig": {
36+
"Enabled": true
37+
},
38+
"TargetOriginId": "integdistributiongrpcTestDistributionOrigin1C4AE5CE4",
39+
"ViewerProtocolPolicy": "allow-all"
40+
},
41+
"Enabled": true,
42+
"HttpVersion": "http2",
43+
"IPV6Enabled": true,
44+
"Origins": [
45+
{
46+
"CustomOriginConfig": {
47+
"OriginProtocolPolicy": "https-only"
48+
},
49+
"DomainName": "www.example.com",
50+
"Id": "integdistributiongrpcTestDistributionOrigin1C4AE5CE4"
51+
}
52+
]
53+
}
54+
}
55+
}
56+
},
57+
"Parameters": {
58+
"BootstrapVersion": {
59+
"Type": "AWS::SSM::Parameter::Value<String>",
60+
"Default": "/cdk-bootstrap/hnb659fds/version",
61+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
62+
}
63+
},
64+
"Rules": {
65+
"CheckBootstrapVersion": {
66+
"Assertions": [
67+
{
68+
"Assert": {
69+
"Fn::Not": [
70+
{
71+
"Fn::Contains": [
72+
[
73+
"1",
74+
"2",
75+
"3",
76+
"4",
77+
"5"
78+
],
79+
{
80+
"Ref": "BootstrapVersion"
81+
}
82+
]
83+
}
84+
]
85+
},
86+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
87+
}
88+
]
89+
}
90+
}
91+
}

packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-grpc.js.snapshot/integ.json

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-grpc.js.snapshot/manifest.json

+113
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)