Skip to content

Commit 9b466ae

Browse files
authored
feat(cloudfront): CloudFront Function runtime property (#28099)
fixed #28163 This provides an option to change the runtime for CloudFront Functions. This makes it easier to access the CloudFront KeyValueStore. https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-function-functionconfig.html ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 030db42 commit 9b466ae

14 files changed

+798
-2
lines changed

.pre-commit-config.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
repos:
2+
- repo: https://github.com/gitleaks/gitleaks
3+
rev: v8.17.0
4+
hooks:
5+
- id: gitleaks

packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/CF2RuntimeDefaultTestDeployAssertB25F4037.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-function-runtime.js.snapshot/CF2RuntimeDefaultTestDeployAssertB25F4037.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-function-runtime.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-function-runtime.js.snapshot/integ-distribution-function.assets.json

+20
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,141 @@
1+
{
2+
"Resources": {
3+
"FunctionRequest95528B2F": {
4+
"Type": "AWS::CloudFront::Function",
5+
"Properties": {
6+
"AutoPublish": true,
7+
"FunctionCode": "function handler(event) { return event.request }",
8+
"FunctionConfig": {
9+
"Comment": "eu-west-1integdistributionfunctionFunctionRequest8E65DEEB",
10+
"Runtime": "cloudfront-js-1.0"
11+
},
12+
"Name": "eu-west-1integdistributionfunctionFunctionRequest8E65DEEB"
13+
}
14+
},
15+
"FunctionResponse4EF2D1D3": {
16+
"Type": "AWS::CloudFront::Function",
17+
"Properties": {
18+
"AutoPublish": true,
19+
"FunctionCode": "function handler(event) { return event.response }",
20+
"FunctionConfig": {
21+
"Comment": "eu-west-1integdistributionfunctionFunctionResponseDD4BADA1",
22+
"Runtime": "cloudfront-js-2.0"
23+
},
24+
"Name": "eu-west-1integdistributionfunctionFunctionResponseDD4BADA1"
25+
}
26+
},
27+
"DistB3B78991": {
28+
"Type": "AWS::CloudFront::Distribution",
29+
"Properties": {
30+
"DistributionConfig": {
31+
"DefaultCacheBehavior": {
32+
"CachePolicyId": "4135ea2d-6df8-44a3-9df3-4b5a84be39ad",
33+
"Compress": true,
34+
"FunctionAssociations": [
35+
{
36+
"EventType": "viewer-request",
37+
"FunctionARN": {
38+
"Fn::GetAtt": [
39+
"FunctionRequest95528B2F",
40+
"FunctionARN"
41+
]
42+
}
43+
},
44+
{
45+
"EventType": "viewer-response",
46+
"FunctionARN": {
47+
"Fn::GetAtt": [
48+
"FunctionResponse4EF2D1D3",
49+
"FunctionARN"
50+
]
51+
}
52+
}
53+
],
54+
"TargetOriginId": "integdistributionfunctionDistOrigin1D1E9DF17",
55+
"ViewerProtocolPolicy": "allow-all"
56+
},
57+
"Enabled": true,
58+
"HttpVersion": "http2",
59+
"IPV6Enabled": true,
60+
"Origins": [
61+
{
62+
"CustomOriginConfig": {
63+
"OriginProtocolPolicy": "https-only"
64+
},
65+
"DomainName": "www.example.com",
66+
"Id": "integdistributionfunctionDistOrigin1D1E9DF17"
67+
}
68+
]
69+
}
70+
}
71+
}
72+
},
73+
"Outputs": {
74+
"RequestFunctionArn": {
75+
"Value": {
76+
"Fn::GetAtt": [
77+
"FunctionRequest95528B2F",
78+
"FunctionARN"
79+
]
80+
}
81+
},
82+
"RequestFunctionStage": {
83+
"Value": {
84+
"Fn::GetAtt": [
85+
"FunctionRequest95528B2F",
86+
"Stage"
87+
]
88+
}
89+
},
90+
"ResponseFunctionArn": {
91+
"Value": {
92+
"Fn::GetAtt": [
93+
"FunctionResponse4EF2D1D3",
94+
"FunctionARN"
95+
]
96+
}
97+
},
98+
"ResponseFunctionStage": {
99+
"Value": {
100+
"Fn::GetAtt": [
101+
"FunctionResponse4EF2D1D3",
102+
"Stage"
103+
]
104+
}
105+
}
106+
},
107+
"Parameters": {
108+
"BootstrapVersion": {
109+
"Type": "AWS::SSM::Parameter::Value<String>",
110+
"Default": "/cdk-bootstrap/hnb659fds/version",
111+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
112+
}
113+
},
114+
"Rules": {
115+
"CheckBootstrapVersion": {
116+
"Assertions": [
117+
{
118+
"Assert": {
119+
"Fn::Not": [
120+
{
121+
"Fn::Contains": [
122+
[
123+
"1",
124+
"2",
125+
"3",
126+
"4",
127+
"5"
128+
],
129+
{
130+
"Ref": "BootstrapVersion"
131+
}
132+
]
133+
}
134+
]
135+
},
136+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
137+
}
138+
]
139+
}
140+
}
141+
}

packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.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-function-runtime.js.snapshot/manifest.json

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

0 commit comments

Comments
 (0)