/terraform-easy-website

(ABANDONDED) Very simple-to-use way to setup a static website on AWS S3, with a CloudFront CDN and with HTTPS using AWS Certificate Manager

Primary LanguageHCLMIT LicenseMIT

Terraform Easy Website

  • Websites are configured with HTTPS by default
  • Works with latest terraform

Prerequisites (for TF modules)

  • Install
  • Configure AWS credentials
  • Delete example tfstate files ( rm tfstate/*.tfstate )
  • Create ACM certificates for the domains you want to use in us-east-1 region and note their IDs
    • e.g., aws acm request-certificate --region us-east-1 --domain-name "*.astarcrm.com" --subject-alternative-names "*.astarcrm.in" --idempotency-token random

      Note:

      • Type the above command only once
      • To use an ACM certificate with Amazon CloudFront, you must request or import the certificate in the US East (N. Virginia) region
    • You will receive an email with instructions for each domain. Follow the steps in it to validate the ownership of domain.

    • Once all the domain names in the certificate request are approved, confirm that the certificate status is Issued on AWS Console

    • Note the ARN in Details section of the certificate

      e.g., arn:aws:acm:us-east-1:352457905336:certificate/bb324c8f-6652-4610-aebc-6baa0b6817c4

Prerequisites (for build.sh)

Usage

  • Create a .json CONFIG_FILE for your subdomain (see examples folder for reference)
  • e.g. CONFIG_FILE=./examples/www.astarcrm.com.json ./build.sh

AWS provider authentication

Configure via environment variables

  • AWS_SECRET_ACCESS_KEY
  • AWS_ACCESS_KEY_ID
  • AWS_DEFAULT_REGION

OR

  • AWS_PROFILE
  • AWS_SHARED_CREDENTIALS_FILE

HTTPS