Skip to content

Latest commit

 

History

History

2021.10.06_TerraformS3Upload

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Abusing Terraform to Upload Static Websites to S3

Purpose

Demonstrate how to use Terraform to create and manage content and its metadata (wrt MIME types and caching) on S3.

Blog post

Usage

This project uses Terraform (get it from https://www.terraform.io/downloads.html). To run main.tf, you'll need:

  • AWS credentials in ~/.aws/credentials under a profile named aws_admin (or you can change the profile name in main.tf)
  • To change the bucket name to something unique

Then, run Terraform with:

# Initialize terraform in the current directory and download the AWS provider
terraform init
# Preview what changes will be made
terraform plan
# Make the changes (create and populate the S3 bucket)
terraform apply

Credit

Credit to https://engineering.statefarm.com/blog/terraform-s3-upload-with-mime/ for the content of mime.json (source from https://github.com/d-henn/s3-upload-terraform-example/blob/master/data/mime.json)