Skip to content

Commit

Permalink
feat(cloudfront): CloudFront Function runtime property (#28099)
Browse files Browse the repository at this point in the history
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*
  • Loading branch information
watany-dev committed Dec 29, 2023
1 parent 030db42 commit 9b466ae
Show file tree
Hide file tree
Showing 14 changed files with 798 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
@@ -0,0 +1,5 @@
repos:
- repo: https://github.com/gitleaks/gitleaks
rev: v8.17.0
hooks:
- id: gitleaks

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1,141 @@
{
"Resources": {
"FunctionRequest95528B2F": {
"Type": "AWS::CloudFront::Function",
"Properties": {
"AutoPublish": true,
"FunctionCode": "function handler(event) { return event.request }",
"FunctionConfig": {
"Comment": "eu-west-1integdistributionfunctionFunctionRequest8E65DEEB",
"Runtime": "cloudfront-js-1.0"
},
"Name": "eu-west-1integdistributionfunctionFunctionRequest8E65DEEB"
}
},
"FunctionResponse4EF2D1D3": {
"Type": "AWS::CloudFront::Function",
"Properties": {
"AutoPublish": true,
"FunctionCode": "function handler(event) { return event.response }",
"FunctionConfig": {
"Comment": "eu-west-1integdistributionfunctionFunctionResponseDD4BADA1",
"Runtime": "cloudfront-js-2.0"
},
"Name": "eu-west-1integdistributionfunctionFunctionResponseDD4BADA1"
}
},
"DistB3B78991": {
"Type": "AWS::CloudFront::Distribution",
"Properties": {
"DistributionConfig": {
"DefaultCacheBehavior": {
"CachePolicyId": "4135ea2d-6df8-44a3-9df3-4b5a84be39ad",
"Compress": true,
"FunctionAssociations": [
{
"EventType": "viewer-request",
"FunctionARN": {
"Fn::GetAtt": [
"FunctionRequest95528B2F",
"FunctionARN"
]
}
},
{
"EventType": "viewer-response",
"FunctionARN": {
"Fn::GetAtt": [
"FunctionResponse4EF2D1D3",
"FunctionARN"
]
}
}
],
"TargetOriginId": "integdistributionfunctionDistOrigin1D1E9DF17",
"ViewerProtocolPolicy": "allow-all"
},
"Enabled": true,
"HttpVersion": "http2",
"IPV6Enabled": true,
"Origins": [
{
"CustomOriginConfig": {
"OriginProtocolPolicy": "https-only"
},
"DomainName": "www.example.com",
"Id": "integdistributionfunctionDistOrigin1D1E9DF17"
}
]
}
}
}
},
"Outputs": {
"RequestFunctionArn": {
"Value": {
"Fn::GetAtt": [
"FunctionRequest95528B2F",
"FunctionARN"
]
}
},
"RequestFunctionStage": {
"Value": {
"Fn::GetAtt": [
"FunctionRequest95528B2F",
"Stage"
]
}
},
"ResponseFunctionArn": {
"Value": {
"Fn::GetAtt": [
"FunctionResponse4EF2D1D3",
"FunctionARN"
]
}
},
"ResponseFunctionStage": {
"Value": {
"Fn::GetAtt": [
"FunctionResponse4EF2D1D3",
"Stage"
]
}
}
},
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/cdk-bootstrap/hnb659fds/version",
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
}
},
"Rules": {
"CheckBootstrapVersion": {
"Assertions": [
{
"Assert": {
"Fn::Not": [
{
"Fn::Contains": [
[
"1",
"2",
"3",
"4",
"5"
],
{
"Ref": "BootstrapVersion"
}
]
}
]
},
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
}
]
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9b466ae

Please sign in to comment.