static-site

biddellns/static-site/aws

Terraform Module HCL AWS

A terraform for generating secure static sites with AWS.

Install
module "static-site" {
source = "biddellns/static-site/aws"
version = "1.4.0"
}
plain text: /constructs/tfmod-biddellns-static-site-aws/install.txt
⭐ Source on GitHub 📦 Registry page
README

Terraform AWS Static Site A terraform module for generating secure static site infrastructure in AWS with S3, Cloudfront, and Lambda. Design decisions detailed here: https://nicbiddell.com/blog/cloudfront-private-s3-and-gatsby/ Benefits - Served by Cloudfront CDN - Seals off public access to your underlying S3 bucket - Adds index.html as an index object. Solves the weird problem that Gatsby and other static site generators have with cloudfront! Providers | Name | Version | |------|---------| | archive | 2.0 | | aws | \>= 3.10, \< 4.0| Inputs | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | bucket\_name | Name of S3 bucket for static assets | string | n/a | yes | | cert\_arn | ARN of ACM cert for cloudfront. If not provided, default Clo

Inputs (7)
NameTypeDescriptionDefault
ci_usernamestringUsername for CI user for syncing s3 files required
bucket_namestringName of S3 bucket for static assets required
provisionerstringWho/what provisioned a resource"Terraform"
cert_arnstringARN of ACM cert for cloudfront. If not provided, default Cloudfront cert will be""
cloudfront_cname_aliaseslist(string)List of alternate CNAMEs for cdn[]
default_cache_timenumberDefault (and currently max) TTL in seconds86400
enabledboolWhether or not the resources for this module should be createdfalse
Outputs (5)
cdn_arn — Arn of Cloudfront Distribution serving the static site.
cdn_domain_name — URL of Cloudfront Distribution serving the static site.
s3_bucket_arn — ARN of S3 bucket holding the site html/css/js and other assets.
index_html_rewriter_lambda — ARN of Lambda ensuring urls end in /index.html if no filename is in request
ci_user — ARN of user with IAM permissions to sync files with s3_bucket
Resources (10)
aws_cloudfront_distributionaws_cloudfront_origin_access_identityaws_iam_policyaws_iam_roleaws_iam_useraws_iam_user_policy_attachmentaws_lambda_functionaws_s3_bucketaws_s3_bucket_policyaws_s3_bucket_public_access_block
Details
FrameworkTerraform Module
LanguageHCL
Version1.4.0
Cloud AWS
★ Stars0
Forks1
Total downloads6.1k
Inputs7
Outputs5
Resources10
Examples2
LicenseMIT
Namespacebiddellns
Updated