Skip to content

Terraform 0.12.x compatible module for creating a s3 static website with cloudfront distribution, and Lambda@Edge function

License

Notifications You must be signed in to change notification settings

twstewart42/terraform-aws-cloudfront-s3-website-lambda-edge

 
 

Repository files navigation

terraform-aws-cloudfront-s3-website-lambda-edge

Terraform 0.12.x compatible module for creating a s3 static website with cloudfront distribution, and Lambda@Edge function

The following resources will be created

  • S3 Bucket
  • Cloudfront distribution
  • Route53 record
  • Lambda@Edge nodejs10.x function to redirect fqdn.com/folder/index.html request to fqdn.com/folder

Prerequisites:

  • Route 53 hosted zone for example.com
  • ACM certificate for *.example.com in us-east-1 region

Example 1

provider "aws" {
  region = "us-east-1"
}
 
module "cloudfront_s3_website" {
    source           = "twstewart42/cloudfront-s3-website-lambda-edge/aws"
    version          = "1.2.1"
    hosted_zone      = "example.com"
    domain_name      = "test.example.com"
    aws_region       = "us-east-1"
}

Variables

Variable Default Description
aws_region us-east-1 AWS Region to host S3 site
domain_name None FQDN of cloudfront alias for the website, S3 bucket name - blog.site.com
hosted_zone None Root domain of website - site.com
tags None Map of the tags for all resources

Credits

The original core 1.0.0 module was developed by chgangaraju/terraform-aws-cloudfront-s3-website

About

Terraform 0.12.x compatible module for creating a s3 static website with cloudfront distribution, and Lambda@Edge function

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • HCL 86.4%
  • JavaScript 13.6%