Skip to content
This repository has been archived by the owner on Oct 8, 2022. It is now read-only.

A terraform module to create an S3 origin for use with CloudFront.

License

Notifications You must be signed in to change notification settings

azavea/terraform-aws-s3-origin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terraform-aws-s3-origin

CircleCI

A Terraform module to create an origin S3 bucket (for use with CloudFront) with read-only access for anonymous users.

Usage

module "static_site" {
  source                      = "github.com/azavea/terraform-aws-s3-origin"
  bucket_name                 = "mysite-bucket"
  logs_bucket_name             = "mysite-logs-bucket"
  project                     = "Unknown"
  environment                 = "Unknown"
}


#
# Cloudfront Distribution
#
resource "aws_cloudfront_distribution" "site" {
  origin {
    domain_name = "${module.static_site.site_bucket}.s3.amazonaws.com"
    origin_id   = "SwaggerSiteOriginEastId"
  }
...

}

Variables

  • bucket_name - Name of bucket where the site will be hosted.
  • logs_bucket_name - Name of the access logs bucket.
  • cors_allowed_headers - Allowed CORS headers (default: ["Authorization"])
  • cors_allowed_methods - Allowed CORS methods (default: ["GET"])
  • cors_allowed_origins - Allowed CORS origins (default: ["*"])
  • cors_expose_headers - Headers to expose in the response (default: [])
  • cors_max_age_seconds - Maximum seconds a browser can cache a response (default: 3000)
  • project - Name of the project that this site is for (default: Unknown)
  • environment - Name of the environment this site is targeting (default: Unknown)
  • tags - A mapping of keys and values to apply as tags to all resources that support them.

Outputs

  • site_bucket - Name of the site bucket
  • site_bucket_regional_domain_name - The region-specific domain name of the site bucket
  • logs_bucket - Name of the logs bucket

About

A terraform module to create an S3 origin for use with CloudFront.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •