Skip to content

dashdevs/terraform-aws-static-website

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terraform-aws-static-website

Usage

IMPORTANT: We do not pin modules to versions in our examples because of the difficulty of keeping the versions in the documentation in sync with the latest released versions. We highly recommend that in your code you pin the version to the exact version you are using so that your infrastructure remains stable, and update versions in a systematic way so that they do not catch you by surprise.

example usage for website module:

module "website" {
  source             = "dashdevs/static-website/aws"
  bucket_name        = var.bucket_name
  domain             = var.domain
  domain_zone_name   = var.domain_zone_name
  create_dns_records = true
}

Requirements

Name Version
terraform >= 1.5.2
aws >= 3.34

Providers

Name Version
aws >= 3.34

Inputs

Name Description Type Default Required
domain Domain name for the site string n/a yes
bucket_name The name for the S3 bucket string n/a yes
domain_zone_name The name of the domain zone in the route53 service for which DNS records will be created. Must be set if create_dns_records is true string null no
create_dns_records If true, then DNS records are created in route53 for this site and connected to the cloudfront distribution bool true no
cors_allowed_origins Used to declare domains from which the site will be accessed as a storage of static resources list(string) null no
s3_policy_statements_additional Additional policy statments that need to be attached to the S3 bucket.
list(object({
sid = string
principals = list(objec({
type = string
identifiers = list(string)
}))
effect = string
actions = list(string)
resources = list(string)
conditions = list(object({
test = string
variable = string
values = list(string)
}))
}))
null no
cloudfront_allowed_bucket_resources List of resources that the Cloudfront is allowed to access. list(string) ["*"] no

Outputs

Name Description
bucket_id The S3 bucket identifier
cloudfront_distribution_id The cloudfront distribution identifier assigned to the S3 bucket
ssl_certificate_validation_dns_records List of text expressions of the certificate validation DNS records to create this records manually. Required if create_dns_records is false
resource_domain_record Text expressions of the website DNS record to create this records manually. Required if create_dns_records is false