Feat
Add possibilty assign custom cloudfront function.
provider "aws" {
alias = "us_east_1"
region = "us-east-1"
}
resource "aws_cloudfront_function" "static_site_request" {
name = "static-site-request"
runtime = "cloudfront-js-2.0"
code = file("${path.module}/resources/static-site-request.js")
publish = true
}
module "static-site" {
source = "cookielab/static-site/aws"
version = "~> 3.4"
providers = {
aws.us_east_1 = aws.us_east_1
}
domains = ["www.example.com"]
domain_zone_id = aws_route53_zone.example_com.zone_id
s3_bucket_name = "example_com_web"
functions = {
viewer_request = aws_cloudfront_function.static_site_request.arn
}
}