Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

This Terraform module creates and configures the necessary AWS resources for hosting a static website. It includes an S3 bucket for content storage, CloudFront for distribution, Origin Access Identity (OAI) for secure access, WAF WebACL for security, a Route 53 DNS record, and an IAM user for continuous deployment to the S3 bucket.

License

NotificationsYou must be signed in to change notification settings

iKnowJavaScript/terraform-aws-complete-static-site

Repository files navigation

Terraform registryTerraformLicense

This Terraform module consist the configuration for hosting a static website on AWS. It creates and configures the necessary AWS resources including S3, Route 53 (DNS), IAM, CloudFront, and WAF.

Description

This Terraform module sets up an S3 bucket for storing your static website content, a CloudFront distribution for content delivery, OAI for access the bucket through CloudFront(Secure access), a WAF WebACL for protecting your site, and a Route 53 record for DNS. It also creates an IAM user for managing continuous deployment to the s3 bucket.

This module provisions:

  • AWS Route53 records
  • AWS ACM certificates
  • AWS CloudFront distributions
  • IAM user
  • S3 bucket

Architecture Diagram

image

Usage

Example with a custom domain (sub domain)

module"frontend" {source="iKnowJavaScript/complete-static-site/aws"name="example-website"environment="prod"create_custom_domain=truehosted_zone_domain="example.com"custom_domain_name="example-website.example.com"aws_region="us-east-1"tags={}}provider"aws" {region="us-east-1"}

Example with default CloudFlare domain

module"frontend" {source="iKnowJavaScript/complete-static-site/aws"name="example-website"environment="prod"create_custom_domain=falseaws_region="us-east-1"tags={}}provider"aws" {region="us-east-1"}

Inputs

NameDescriptionTypeDefaultRequired
aws_regionThe AWS region to create resources instringn/ano
hosted_zone_domain(OPTIONAL) Hosted zone to add doamin and cloufront Cname tostringn/ano
custom_domain_name(OPTIONAL) Custom domain name. should be a sub.domain to the main domain available on the hosted zone or ''(empty string) to use the domain on hosted zone.stringn/ano
create_custom_domainWhether to create a custom domainboolfalseno
nameThe project namestringn/ayes
environmentThe environment the resources is meant for.stringn/ayes
tagsResources tags.map(string)n/ano

Outputs

NameDescriptionSensitive
cloudflare_domainDirect cloudflare domainNo
custom_domainCustom domain nameNo
bucket_nameS3 bucket nameNo
access_key_idThe access key ID for the S3 userNo
secret_access_keyThe secret access key for the S3 userYes
domain_certificate_arnThe ARN of the domain certificateNo

To view sensitive secret, tryterraform output secret_access_key

License

This project is licensed under the MIT License - see theLICENSE.md file for details.

About

This Terraform module creates and configures the necessary AWS resources for hosting a static website. It includes an S3 bucket for content storage, CloudFront for distribution, Origin Access Identity (OAI) for secure access, WAF WebACL for security, a Route 53 DNS record, and an IAM user for continuous deployment to the S3 bucket.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp