static-website

cloudmaniac/static-website/aws

Terraform Module HCL AWS

Terraform Module to provision an AWS static website using Route53, S3, and CloudFront.

Install
module "static-website" {
source = "cloudmaniac/static-website/aws"
version = "1.1.0"
}
⭐ Source on GitHub 📦 Registry page
README

AWS Static Website Terraform Module Terraform module which provision required AWS resources to host a performant and secured static website. Features This Terraform module creates the following AWS resources: AWS Certificate Manager: wildcard certificate for your domain. S3 Bucket #1: to store logs. Bucket #2: to store the content (example.com). Bucket #3: to redirect a different subdomain to the main domain (e.g., www.example.com redirected to example.com). CloudFront Distribution #1: to frontend the website. Distribution #2: to frontend the subdomain that will be redirected to the main domain. Route53 record sets pointing to the two CloudFront distributions. Requirements This module is meant for use with Terraform 0.12+. It has not been tested with previous versions of Terraform. An AWS

Inputs (8)
NameTypeDescriptionDefault
website-domain-mainstringMain website domain, e.g. cloudmaniac.net required
website-domain-redirectstringSecondary FQDN that will redirect to the main URL (e.g., www.cloudmaniac.net) required
domains-zone-rootstringRoot zone under which the domains should be registered required
cloudfront_lambda_function_arnstring The optional ARN of AWS Lambda Function that can be associated w required
website-additional-domainslist(string)Main website additional domains (e.g., additional.cloudmaniac.net) that don't ne[]
tagsmap(string)Tags added to resources{}
support-spaboolSupport SPA (Single-Page Application) website with redirect to index.htmlfalse
cloudfront_lambda_function_event_typestring The type of event that triggers the above Lambda Function. For p"origin-request"
Outputs (4)
website_redirect_s3_bucket — The s3 bucket of the website redirect bucket
website_cdn_root_id — Main CloudFront Distribution ID
website_root_s3_bucket — The website root bucket where resources are uploaded
website_logs_s3_bucket — The s3 bucket of the website logs
Resources (6)
aws_acm_certificateaws_acm_certificate_validationaws_cloudfront_distributionaws_route53_recordaws_s3_bucketaws_s3_bucket_policy
Details
FrameworkTerraform Module
LanguageHCL
Version1.1.0
Cloud AWS
★ Stars54
Forks40
Total downloads8.1k
Inputs8
Outputs4
Resources6
LicenseMIT
Namespacecloudmaniac
Updated