Skip to content

Commit 2b0ed53

Browse files
authored
feat(cloudfront-origin): adding FunctionUrlOrigin (#29101)
### Reason for this change `origins.httpOrigin` requires a trick to specify the Lambda Functions URL. ### Description of changes This eases that pain and simplifies integration. ### Description of how you validated changes ### 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 3c122a4 commit 2b0ed53

13 files changed

+836
-0
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.function-url-origin.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-origins/test/integ.function-url-origin.js.snapshot/integ-cloudfront-function-url-origin.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,157 @@
1+
{
2+
"Resources": {
3+
"MyFunctionServiceRole3C357FF2": {
4+
"Type": "AWS::IAM::Role",
5+
"Properties": {
6+
"AssumeRolePolicyDocument": {
7+
"Statement": [
8+
{
9+
"Action": "sts:AssumeRole",
10+
"Effect": "Allow",
11+
"Principal": {
12+
"Service": "lambda.amazonaws.com"
13+
}
14+
}
15+
],
16+
"Version": "2012-10-17"
17+
},
18+
"ManagedPolicyArns": [
19+
{
20+
"Fn::Join": [
21+
"",
22+
[
23+
"arn:",
24+
{
25+
"Ref": "AWS::Partition"
26+
},
27+
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
28+
]
29+
]
30+
}
31+
]
32+
}
33+
},
34+
"MyFunction3BAA72D1": {
35+
"Type": "AWS::Lambda::Function",
36+
"Properties": {
37+
"Code": {
38+
"ZipFile": "exports.handler = async () => {};"
39+
},
40+
"Handler": "index.handler",
41+
"Role": {
42+
"Fn::GetAtt": [
43+
"MyFunctionServiceRole3C357FF2",
44+
"Arn"
45+
]
46+
},
47+
"Runtime": "nodejs20.x"
48+
},
49+
"DependsOn": [
50+
"MyFunctionServiceRole3C357FF2"
51+
]
52+
},
53+
"MyFunctionFunctionUrlFF6DE78C": {
54+
"Type": "AWS::Lambda::Url",
55+
"Properties": {
56+
"AuthType": "NONE",
57+
"TargetFunctionArn": {
58+
"Fn::GetAtt": [
59+
"MyFunction3BAA72D1",
60+
"Arn"
61+
]
62+
}
63+
}
64+
},
65+
"MyFunctioninvokefunctionurl171A3163": {
66+
"Type": "AWS::Lambda::Permission",
67+
"Properties": {
68+
"Action": "lambda:InvokeFunctionUrl",
69+
"FunctionName": {
70+
"Fn::GetAtt": [
71+
"MyFunction3BAA72D1",
72+
"Arn"
73+
]
74+
},
75+
"FunctionUrlAuthType": "NONE",
76+
"Principal": "*"
77+
}
78+
},
79+
"Distribution830FAC52": {
80+
"Type": "AWS::CloudFront::Distribution",
81+
"Properties": {
82+
"DistributionConfig": {
83+
"DefaultCacheBehavior": {
84+
"CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e58f6",
85+
"Compress": true,
86+
"TargetOriginId": "integcloudfrontfunctionurloriginDistributionOrigin19836FF4B",
87+
"ViewerProtocolPolicy": "allow-all"
88+
},
89+
"Enabled": true,
90+
"HttpVersion": "http2",
91+
"IPV6Enabled": true,
92+
"Origins": [
93+
{
94+
"CustomOriginConfig": {
95+
"OriginProtocolPolicy": "https-only",
96+
"OriginSSLProtocols": [
97+
"TLSv1.2"
98+
]
99+
},
100+
"DomainName": {
101+
"Fn::Select": [
102+
2,
103+
{
104+
"Fn::Split": [
105+
"/",
106+
{
107+
"Fn::GetAtt": [
108+
"MyFunctionFunctionUrlFF6DE78C",
109+
"FunctionUrl"
110+
]
111+
}
112+
]
113+
}
114+
]
115+
},
116+
"Id": "integcloudfrontfunctionurloriginDistributionOrigin19836FF4B"
117+
}
118+
]
119+
}
120+
}
121+
}
122+
},
123+
"Parameters": {
124+
"BootstrapVersion": {
125+
"Type": "AWS::SSM::Parameter::Value<String>",
126+
"Default": "/cdk-bootstrap/hnb659fds/version",
127+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
128+
}
129+
},
130+
"Rules": {
131+
"CheckBootstrapVersion": {
132+
"Assertions": [
133+
{
134+
"Assert": {
135+
"Fn::Not": [
136+
{
137+
"Fn::Contains": [
138+
[
139+
"1",
140+
"2",
141+
"3",
142+
"4",
143+
"5"
144+
],
145+
{
146+
"Ref": "BootstrapVersion"
147+
}
148+
]
149+
}
150+
]
151+
},
152+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
153+
}
154+
]
155+
}
156+
}
157+
}

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

+137
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-origins/test/integ.function-url-origin.js.snapshot/restapioriginDefaultTestDeployAssert6BBA15BA.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-origins/test/integ.function-url-origin.js.snapshot/restapioriginDefaultTestDeployAssert6BBA15BA.template.json

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

0 commit comments

Comments
 (0)