Skip to content

Used to publish static website files to an S3 bucket with proper MIME type based on lookup using the file extension.

License

Notifications You must be signed in to change notification settings

Lupus-Metallum/terraform-aws-s3-static-website

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

terraform-aws-s3-static-website

Used to publish static website files to an S3 bucket with proper MIME type, etag, acl, cache control, and object level server-side encryption.

Terraform Versions Supported

>=1.2.0

Example

module "s3-static-website" {
  source        = "Lupus-Metallum/s3-static-website/aws"
  version       = "2.0.0"
  
  bucket_id        = aws_s3_bucket.example.id
  file_path        = "${path.module}/src/my-website-files/" # Where your index.html and TLD web content lives
  acl              = "public-read"
  storage_class    = "STANDARD"
  cache_control    = "max-age=31536000"
  content_language = "en-US"
  sse_encrypt      = true #Changing this variable will force the recreation of each file managed by this module
}

Requirements

Name Version
terraform >= 1.2.0

Providers

Name Version
aws n/a
random n/a

Resources

Name Type
aws_s3_object.this resource
random_pet.this resource

Inputs

Name Description Type Default Required
bucket_id The bucket id to use as the destination for the static website string n/a yes
file_path The base filepath that contains the files to publish, you may need path.module/my/src/dir string n/a yes
acl The object acl to use for this site, defaults to public-read string "public-read" no
cache_control The header to use for cache control string "max-age=1440" no
content_language en-US or en-GB for language header? string "en-US" no
sse_encrypt Should we apply SSE for objects created by this module? bool true no
storage_class The object storage class to use for this site, defaults to STANDARD string "STANDARD" no