Skip to content

Simple terraform module which is used to create infra for igor.kupczynski.info blog

License

Notifications You must be signed in to change notification settings

igor-kupczynski/terraform_static_aws_website

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A module which creates AWS infrastucture for serving a static website

It creates:

  1. S3 bucket configured to serve the stored resources as a webpage.

  2. Cloudfront distribution which fronts the bucket.

  3. Optionally, a bucket which redirects www (or other subdomain) --> naked domain (and a cloud front if certificate arn is provided).

  4. Optionally, a lambda function to invalidate CDN when the object in s3 bucket is changed.

DNS configuration and publishing the website are left for the user and are not a scope of this module (yet).

It is assumed that the aws credentials are provided via env variables.

User needs to create an SSL certificate in AWS certificate manager.

This module is used to provide the infra for my blog - kupczynski.info and a couple of other websites.

Usage example

provider "aws" {
  region = "us-east-1"
}

module "geek_igor_hosting" {
  source = "github.com/igor-kupczynski/terraform_static_aws_website"

  domain              = "${var.domain}"       # for example "kupczynski.info"
  index_document      = "index.html"
  error_404_document  = "errors/404.html"
  redirect_subdomain  = "www"                 # usually this is "www", skip if you don't need a subdomain redirect
  ssl_certificate_arn = "${var.cert}"         # can be generated in aws certificate manager, skip if you don't need a https connection
                                              #  managed by aws; skipping this won't generate a cloud front distribution at all
  invalidate_cloud_front_on_s3_update = true  # create CloudFront invalidations
                                              #  for each object updated in S3,
                                              #  defaults to true 
}

About

Simple terraform module which is used to create infra for igor.kupczynski.info blog

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published