Skip to content

smartassistco/terraform-aws-staticwebsite

Repository files navigation

AWS Static Website Terraform Module

What does it do?

Creates a static website with all the necessary dependencies:

  • S3 Bucket
  • S3 Bucket Website Configuration
  • IAM user with deploy permissions
  • Validated ACM cert (in us-east-1)
  • CloudFront distribution
  • DNS record for domain name

Currently, only supports Cloudflare for DNS records

Requirements

Name Version
aws >= 4.15, < 5.0
cloudflare >= 3.15, < 4.0

Providers

Name Version
aws >= 4.15, < 5.0
cloudflare >= 3.15, < 4.0

Modules

Name Source Version
bucket smartassistco/s3website/aws n/a
certificate smartassistco/cloudflare-validated-acm/aws n/a

Resources

Name Type
aws_cloudfront_distribution.cloudfront_distribution resource
cloudflare_record.dns_record resource

Inputs

Name Description Type Default Required
cloudflare_zone_id The Zone ID for the DNS provider string n/a yes
domain_name The domain name for the website, e.g. demo.example.com string n/a yes
error_file The name of the error file in the S3 bucket string "404.html" no
index_file The name of the error file in the S3 bucket string "index.html" no
project_name The name of the project, which will be used to create the S3 bucket and deploy user. e.g. demo-website string n/a yes

Outputs

Name Description
deploy_bucket The S3 bucket to deploy the website files
deploy_user_creds The AWS credentials for the deploy user