/terraform-aws-cloudfront-s3

Terraform module to provision an AWS CloudFront CDN with the private S3 origin.

Primary LanguageHCLGNU General Public License v3.0GPL-3.0

AWS Terraform Cloudfront distribution S3 backend

Terraform module which creates AWS CloudFront Distribution with the S3 as a backend.

Module Schema

Requirements

Name Version
terraform >= 0.15.0
aws >= 3.40.0

Providers

Name Version
aws >= 3.40.0
aws.virginia >= 3.40.0

Modules

No modules.

Resources

Name Type
aws_acm_certificate.certificate resource
aws_acm_certificate_validation.validation resource
aws_cloudfront_distribution.website resource
aws_cloudfront_origin_access_identity.cf-identity resource
aws_route53_record.alias resource
aws_route53_record.validation resource
aws_s3_bucket.bucket resource
aws_s3_bucket_object.website resource
aws_s3_bucket_policy.s3_policy_attach resource
aws_s3_bucket_public_access_block.bucket_block_public resource
aws_iam_policy_document.s3_policy data source
aws_route53_zone.zone data source

Inputs

Name Description Type Default Required
cf_cache_allowed Allowed methods list(string)
[
"GET",
"HEAD",
"OPTIONS"
]
no
cf_cached_methods Methods for caching list(string)
[
"GET",
"HEAD"
]
no
cf_compress Do you want to enable compression bool true no
cf_default_ttl Default ttl for caching number 3600 no
cf_enabled Whether if cf is enabled bool true no
cf_geo_restrictions Map for restriction any {} no
cf_http_version HTTP version for cf string "http2" no
cf_is_ipv6_enabled Whether if ipv6 is enabled bool true no
cf_logging Map for restriction. You can define key bucket and set bucket name for logging, key include_cookies in order to include cookies in logs (default is false), and key prefix for prefix for storing logs in bucket (default is '/') any {} no
cf_max_ttl Max ttl for caching number 86400 no
cf_min_ttl Min ttl for caching number 0 no
cf_minimum_protocol_version Minimum protocol version for SSL string "TLSv1.2_2019" no
cf_origin_access_identity_comment Comment for CloudFront Identity string "" no
cf_ssl_support_method SSL support method for CloudFront string "sni-only" no
cf_viewer_protocol_policy CloudFront viewer protocol policy string "redirect-to-https" no
domain_name The domain name for the website. string n/a yes
hostname hostname for website without domain string n/a yes
module_depends_on List of resources which module depends on list(string) [] no
module_enabled Whether to create resources within the module or not. Default is true. bool true no
s3_acl ACL for bucket. Possible values: private, public-read, public-read-write, aws-exec-read, authenticated-read, and log-delivery-write string "public-read" no
s3_index_document File in bucket which should be index page string "index.html" no
s3_upload_files_path Path to the folder with files for uploading to the s3 bucket string n/a yes
s3_versioning Whether to enable versioning on S3 or not. Default is true bool true no

Outputs

Name Description
bucket_acl ACL of the backend S3 bucket
bucket_arn ARN of the backend S3 bucket
bucket_domain_name Domain name of the backend S3 bucket
bucket_name Name of the backend S3 bucket
cloudfront_distribution_id CF Distribution ID