s3-static-website

cn-terraform/s3-static-website/aws

Terraform Module HCL AWS

Terraform Module for AWS to host Static Website on S3

Install
module "s3-static-website" {
source = "cn-terraform/s3-static-website/aws"
version = "1.2.0"
}
⭐ Source on GitHub 📦 Registry page
README

AWS S3 Static Website # This Terraform module provides the required infrastructure to host a static website on S3. ![](https://github.com/cn-terraform/terraform-aws-s3-static-website/actions?query=workflow%3Aterraform) ![](https://github.com/cn-terraform/terraform-aws-s3-static-website) ![](https://github.com/cn-terraform/terraform-aws-s3-static-website) ![](https://github.com/cn-terraform/terraform-aws-s3-static-website) ![](https://github.com/cn-terraform/terraform-aws-s3-static-website) ![](https://github.com/cn-terraform/terraform-aws-s3-static-website) Usage Check versions for this module on: Github Releases: Terraform Module Registry: Install pre commit hooks. Run this command right after cloning the repository. pre-commit install For that you may need to install the following tools:

Inputs (50)
NameTypeDescriptionDefault
name_prefixstringName prefix for resources on AWS required
website_domain_namestringThe domain name to use for the website required
create_route53_hosted_zoneboolEnable or disable Route 53 hosted zone creation. If set to false, the variable rtrue
website_cors_additional_allowed_originslist(string)(Optional) Specifies which origins are allowed besides the domain name specified[]
website_cors_expose_headerslist(string)(Optional) Specifies expose header in the response.[]
website_cors_max_age_secondsnumber(Optional) Specifies time in seconds that browser can cache the response for a p3600
www_website_versioning_enabledbool(Optional) Enable versioning. Once you version-enable a bucket, it can never rettrue
cloudfront_function_associationlist(object({ event_type (Optional - up to 2 per distribution) List containing information to associate a[]
cloudfront_custom_error_responseslist(object({ error_cachinA list of custom error responses[]
cloudfront_geo_restriction_typestringThe method that you want to use to restrict distribution of your content by coun"none"
cloudfront_geo_restriction_locationslist(string)(Optional) - The ISO 3166-1-alpha-2 codes for which you want CloudFront either t[]
website_bucket_acl_enabledbool(Optional) Whether to manage and apply bucket ACL settings. Keep true for backwatrue
website_error_documentstring(Optional) An absolute path to the document to return in case of a 4XX error. De"404.html"
website_versioning_statusstring(Optional) The versioning state of the bucket. Valid values: Enabled or Suspende"Enabled"
cloudfront_default_origin_request_policy_idstring(Optional) The origin request policy ID for the default cache behavior. Defaults"88a5eaf4-2fd4-4709-b370-b4c650ea3fcf"
cloudfront_website_retain_on_deletebool(Optional) - Disables the distribution instead of deleting it when destroying thfalse
create_acm_certificateboolEnable or disable automatic ACM certificate creation. If set to false, the variatrue
tagsmap(string)Resource tags{}
website_versioning_mfa_deletestring(Optional) Specifies whether MFA delete is enabled in the bucket versioning conf"Disabled"
www_website_bucket_aclstring(Optional) The canned ACL to apply. Valid values are private, public-read, publi"private"
cloudfront_viewer_protocol_policystringUse this element to specify the protocol that users can use to access the files "redirect-to-https"
cloudfront_enable_compressionbool(Optional, Default:false) Enable compression with Gzip or Brotli for requests wifalse
… and 10 more inputs
Outputs (36)
website_bucket_domain_name — The bucket domain name. Will be of format bucketname.s3.amazonaws.com.
hosted_zone_id — The Hosted Zone ID. This can be referenced by zone records.
acm_certificate_arn — The ARN of the certificate
cloudfront_website_domain_name — The domain name corresponding to the distribution. For example: d604721fxaaqy9.cloudfront.net.
cloudfront_website_in_progress_validation_batches — The number of invalidation batches currently in progress.
hosted_zone_name_servers — A list of name servers in the associated (or default) delegation set. Find more about delegation set
route_53_record_www_website_name — The name of the record.
website_bucket_id — The name of the bucket.
website_bucket_regional_domain_name — The bucket region-specific domain name. The bucket domain name including the region name, please ref
cloudfront_website_arn — The ARN (Amazon Resource Name) for the distribution. For example: arn:aws:cloudfront::123456789012:d
cloudfront_website_trusted_key_groups — List of nested attributes for active trusted key groups, if the distribution is set up to serve priv
acm_certificate_tags_all — A map of tags assigned to the resource, including those inherited from the provider default_tags con
website_bucket_arn — The ARN of the bucket. Will be of format arn:aws:s3:::bucketname.
website_bucket_hosted_zone_id — The Route 53 Hosted Zone ID for this bucket's region.
website_bucket_region — The AWS region this bucket resides in.
route_53_record_www_website_fqdn — FQDN built using the zone domain and name.
cert_validation_id — The time at which the certificate was issued
website_logs_bucket_id — The name of the bucket which holds the access logs
cloudfront_website_status — The current status of the distribution. Deployed if the distribution's information is fully propagat
cloudfront_website_tags_all — A map of tags assigned to the resource, including those inherited from the provider default_tags con
route_53_record_website_name — The name of the record.
cert_validation_certificate_arn — The ARN of the certificate that is being validated.
cloudfront_website_etag — The current version of the distribution's information. For example: E2QWRUHAPOMQZL.
route_53_record_website_fqdn — FQDN built using the zone domain and name.
acm_certificate_domain_name — The domain name for which the certificate is issued
website_bucket_tags_all — A map of tags assigned to the resource, including those inherited from the provider default_tags con
cloudfront_website_caller_reference — Internal value used by CloudFront to allow future updates to the distribution configuration.
cloudfront_website_last_modified_time — The date and time the distribution was last modified.
hosted_zone_tags_all — A map of tags assigned to the resource, including those inherited from the provider default_tags con
acm_certificate_id — The ARN of the certificate
… and 6 more outputs
Resources (15)
aws_acm_certificateaws_acm_certificate_validationaws_cloudfront_distributionaws_cloudfront_origin_access_identityaws_route53_recordaws_route53_zoneaws_s3_bucketaws_s3_bucket_aclaws_s3_bucket_cors_configurationaws_s3_bucket_loggingaws_s3_bucket_ownership_controlsaws_s3_bucket_policyaws_s3_bucket_public_access_blockaws_s3_bucket_server_side_encryption_configurationaws_s3_bucket_versioning
Details
FrameworkTerraform Module
LanguageHCL
Version1.2.0
Cloud AWS
★ Stars23
Forks40
Total downloads138.1k
Inputs50
Outputs36
Resources15
Examples7
LicenseApache-2.0
Namespacecn-terraform
Updated