ssunday / terraform-s3-static-website

Terraform script to configure S3/Cloudfront for a static website

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Terraform S3 Static Site Setup

Terraform script to configure S3 and Cloudfront for static website hosting. Restricted access to Cloudfront via referer header, custom domain, and so on.

Mostly just playing around with Terraform based on the documentation.

Requirements

Usage

  1. terraform init
  2. cp environment.tfvars.example environment.tfvars and change as needed (see Settings section)
  3. Verify: terraform plan -var-file=environment.tfvars
  4. Invoke: terraform apply -var-file=environment.tfvars

Other commands

  • Destroy: terraform destroy -var-file=environment.tfvars

Settings

region = AWS_REGION
profile = AWS_PROFILE
s3_bucket = BUCKET_NAME_YOU_WANT
s3_origin_id = BUCKET_ORIGIN_ID (also used for referer header)
aliases = LIST_OF_DOMAINS
acm_certificate_arn = ACM CERTIFICATE ARN

About

Terraform script to configure S3/Cloudfront for a static website


Languages

Language:HCL 100.0%