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

Terraform Module to spin up a CloudFront distribution in AWS

License

NotificationsYou must be signed in to change notification settings

xoap-io/terraform-aws-web-cloudfront

MaintainedTerraformLicense: MIT

Table of Contents


Introduction

This is a template for Terraform modules.

It is part of our XOAP Automation Forces Open Source community library to give you a quick start into Infrastructure as Code deployments with Terraform.

We have a lot of Terraform modules that are Open Source and maintained by the XOAP staff.

Please check the links for more info, including usage information and full documentation:


Guidelines

We are using the following guidelines to write code and make it easier for everyone to follow a destinctive guideline. Please check these links before starting to work on changes.

Contributor Covenant

Git Naming Conventions are an important part of the development process. They descrtibe how Branched, Commit Messages, Pull Requests and Tags should look like to make the easily understandebla for everybody in the development chain.

Git Naming Conventions

he Conventional Commits specification is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an explicit commit history; which makes it easier to write automated tools on top of.

Conventional Commits

The better a Pull Request description is, the better a review can understand and decide on how to review the changes. This improves implementation speed and reduces communication between the requester and the reviewer resulting in much less overhead.

Wiriting A Great Pull Request Description

Versioning is a crucial part for Terraform Stacks and Modules. Without version tags you cannot clearly create a stable environment and be sure that your latest changes won't crash your production environment (sure it still can happen, but we are trying our best to implement everything that we can to reduce the risk)

Semantic Versioning

Naming Conventions for Terraform resources must be used.

Terraform Naming Conventions


Usage

Installation

For the first ime using this template necessary tools need to be installed.A script for PowerShell Core is provided under ./build/init.ps1

This script will install following dependencies:

This script configures:

  • global git template under ~/.git-template
  • global pre-commit hooks for prepare-commit-msg and commit-msg under ~/.git-template/hooks
  • github actions:
    • linting and checks for pull requests from dev to master/main
    • automatic tagging and release creation on pushes to master/main
    • dependabot updates

It currently supports the automated installation for macOS. Support for Windows and Linux will be available soon.

Synchronisation

We provided a script under ./build/sync_template.ps1 to fetch the latest changes from this template repository.Please be aware that this is mainly a copy operation which means all your current changes have to be committed first and after running the script you have to merge this changes into your codebase.

Configuration


Requirements

NameVersion
terraform>=1.1.6
aws>= 4.8.0

Providers

NameVersion
aws>= 4.8.0

Modules

NameSourceVersion
bucketgit::github.com/xoap-io/terraform-aws-storage-s3.gitv0.1.3
this_labelgit::github.com/xoap-io/terraform-aws-misc-labelv0.1.1

Resources

NameType
aws_cloudfront_cache_policy.thisresource
aws_cloudfront_distribution.thisresource
aws_cloudfront_origin_request_policy.thisresource
aws_cloudfront_response_headers_policy.thisresource

Inputs

NameDescriptionTypeDefaultRequired
allowed_methodsAllowed methods for accessing the CloudFront Distributionlist(string)
[
"GET",
"HEAD",
"OPTIONS"
]
no
cached_methodsCache methods for accessing the CloudFront Distributionlist(string)
[
"GET",
"HEAD"
]
no
cf_default_ttlCloudFront default TTL for cachinestring"86400"no
cf_max_ttlCloudFront maximum TTL for cachingstring"31536000"no
cf_min_ttlCloudFront minimum TTL for cachingstring"0"no
cf_price_classCloudFront price classstring"PriceClass_All"no
cloudfront_aliasesList of hostnames to serve site on. E.g. with and without wwwlist(string)n/ayes
cloudfront_allowed_methodsAllowed methods for accessing the CloudFront Distributionlist(string)
[
"GET",
"HEAD",
"OPTIONS",
"PUT",
"POST",
"PATCH",
"DELETE"
]
no
cloudfront_cached_methodsCache methods for accessing the CloudFront Distributionlist(string)
[
"GET",
"HEAD"
]
no
cloudfront_certificate_arnARN of the ACM certificate to use for cloudfront. Must be issued in us-east-1stringn/ayes
cloudfront_default_ttlCloudFront default TTL for cachinestring"1"no
cloudfront_max_ttlCloudFront maximum TTL for cachingstring"10"no
cloudfront_min_ttlCloudFront minimum TTL for cachingstring"0"no
cloudfront_minimum_tls_versionMinimum allowed TLS versionstring"TLSv1.2_2021"no
cloudfront_origin_idOrigin ID used in CloudFrontstring"alb"no
cloudfront_price_classCloudFront price classstring"PriceClass_All"no
cloudfront_viewer_protocol_policyOne of allow-all, https-only, or redirect-to-httpsstring"redirect-to-https"no
contextDefault environmental context
object({
organization = string
environment = string
account = string
product = string
tags = map(string)
})
n/ayes
cors_allowed_headersList of headers allowed in CORSlist(string)[]no
cors_allowed_methodsList of methods allowed in CORSlist(string)
[
"GET"
]
no
cors_allowed_originsList of origins allowed to make CORS requestslist(string)
[
"https://s3.amazonaws.com"
]
no
cors_expose_headersList of headers to expose in CORS responselist(string)[]no
cors_max_age_secondsSpecifies time in seconds that browser can cache the response for a preflight requeststring3000no
custom_error_responseOptionally a list of custom error response configurations for CloudFront distribution
set(object({
error_code = number
response_code = number
response_page_path = string
}))
nullno
default_root_objectCloudFront distribution default_root_objectstring"index.html"no
error_documentError page document in S3 bucketstring"404.html"no
index_documentIndex page document in S3 bucketstring"index.html"no
logging_bucketTarget Bucket name for loggingstringn/ayes
minimum_tls_versionMinimum support TLS versionstring"TLSv1.2_2021"no
origin_pathPath in S3 bucket for hosted files, with leading slashstring""no
routing_rulesA json array containing routing rules describing redirect behavior and when redirects are appliedmap(string)
{
"/": "index.html"
}
no
s3_origin_idOrigin ID used in CloudFrontstring"s3-origin"no
site_nameName of bucket to be created in S3. Must be globally unique.stringn/ayes
viewer_protocol_policyOne of allow-all, https-only, or redirect-to-httpsstring"redirect-to-https"no

Outputs

NameDescription
aliasesn/a
cloudfront_arnn/a
cloudfront_hostnamen/a
cloudfront_idn/a
cloudfront_zone_idn/a
s3n/a
thisn/a

About

Terraform Module to spin up a CloudFront distribution in AWS

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors4

  •  
  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp