-
-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Migrate readme yaml * Update related section * Fix related project name * Regenerate README.md * Add travis.yaml * Update module versions
- Loading branch information
1 parent
44120cc
commit 12f64bd
Showing
11 changed files
with
504 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,6 @@ | |
.terraform/ | ||
.idea | ||
*.iml | ||
|
||
.build-harness | ||
build-harness |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
addons: | ||
apt: | ||
packages: | ||
- git | ||
- make | ||
- curl | ||
|
||
install: | ||
- make init | ||
|
||
script: | ||
- make terraform/install | ||
- make terraform/get-plugins | ||
- make terraform/get-modules | ||
- make terraform/lint | ||
- make terraform/validate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
SHELL := /bin/bash | ||
|
||
# List of targets the `readme` target should call before generating the readme | ||
export README_DEPS ?= docs/targets.md docs/terraform.md | ||
|
||
-include $(shell curl -sSL -o .build-harness "https://git.io/build-harness"; echo .build-harness) | ||
|
||
## Lint terraform code | ||
lint: | ||
$(SELF) terraform/install terraform/get-modules terraform/get-plugins terraform/lint terraform/validate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
--- | ||
# | ||
# This is the canonical configuration for the `README.md` | ||
# Run `make readme` to rebuild the `README.md` | ||
# | ||
|
||
# Name of this project | ||
name: terraform-aws-cloudfront-cdn | ||
|
||
# Logo for this project | ||
#logo: docs/logo.png | ||
|
||
# License of this project | ||
license: "APACHE2" | ||
|
||
# Canonical GitHub repo | ||
github_repo: cloudposse/terraform-aws-cloudfront-cdn | ||
|
||
# Badges to display | ||
badges: | ||
- name: "Build Status" | ||
image: "https://travis-ci.org/cloudposse/terraform-aws-cloudfront-cdn.svg?branch=master" | ||
url: "https://travis-ci.org/cloudposse/terraform-aws-cloudfront-cdn" | ||
- name: "Latest Release" | ||
image: "https://img.shields.io/github/release/cloudposse/terraform-aws-cloudfront-cdn.svg" | ||
url: "https://github.com/cloudposse/terraform-aws-cloudfront-cdn/releases/latest" | ||
- name: "Slack Community" | ||
image: "https://slack.cloudposse.com/badge.svg" | ||
url: "https://slack.cloudposse.com" | ||
|
||
related: | ||
- name: "terraform-aws-cloudfront-s3-cdn" | ||
description: "Terraform module to easily provision CloudFront CDN backed by an S3 origin" | ||
url: "https://github.com/cloudposse/terraform-aws-cloudfront-s3-cdn" | ||
- name: "terraform-aws-s3-log-storage" | ||
description: "This module creates an S3 bucket suitable for receiving logs from other AWS services such as S3, CloudFront, and CloudTrail" | ||
url: "https://github.com/cloudposse/terraform-aws-s3-log-storage" | ||
- name: "terraform-aws-cloudtrail" | ||
description: "Terraform module to provision an AWS CloudTrail and an encrypted S3 bucket with versioning to store CloudTrail logs" | ||
url: "https://github.com/cloudposse/terraform-aws-cloudtrail" | ||
- name: "terraform-aws-s3-website" | ||
description: "Terraform module to provision S3-backed Websites" | ||
url: "https://github.com/cloudposse/terraform-aws-s3-website" | ||
- name: "terraform-root-modules/aws/docs" | ||
description: "Reference implementation combining `terraform-aws-s3-website` with `terraform-aws-cdn`" | ||
url: "https://github.com/cloudposse/terraform-root-modules/tree/master/aws/docs" | ||
|
||
# Short description of this project | ||
description: |- | ||
Terraform Module that implements a CloudFront Distribution (CDN) for a custom origin (e.g. website) and [ships logs to a bucket](https://github.com/cloudposse/terraform-aws-log-storage). | ||
If you need to accelerate an S3 bucket, we suggest using [`terraform-aws-cloudfront-s3-cdn`](https://github.com/cloudposse/terraform-aws-cloudfront-s3-cdn) instead. | ||
# How to use this project | ||
usage: |- | ||
Basic usage: | ||
```hcl | ||
module "cdn" { | ||
source = "git::https://github.com/cloudposse/terraform-aws-cloudfront-cdn.git?ref=master" | ||
namespace = "cp" | ||
stage = "prod" | ||
name = "app" | ||
aliases = ["cloudposse.com", "www.cloudposse.com"] | ||
parent_zone_name = "cloudposse.com" | ||
origin_domain_name = "origin.cloudposse.com" | ||
} | ||
``` | ||
Complete example of setting up CloudFront Distribution with Cache Behaviors for a WordPress site: [`examples/wordpress`](examples/wordpress/main.tf) | ||
### Generating ACM Certificate | ||
Use the AWS cli to [request new ACM certifiates](http://docs.aws.amazon.com/acm/latest/userguide/gs-acm-request.html) (requires email validation) | ||
``` | ||
aws acm request-certificate --domain-name example.com --subject-alternative-names a.example.com b.example.com *.c.example.com | ||
``` | ||
include: | ||
- "docs/targets.md" | ||
- "docs/terraform.md" | ||
|
||
# Contributors to this project | ||
contributors: | ||
- name: "Erik Osterman" | ||
github: "osterman" | ||
- name: "Igor Rodionov" | ||
github: "goruha" | ||
- name: "Andriy Knysh" | ||
github: "aknysh" | ||
- name: "Justin Burnham" | ||
github: "jburnham" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
## Makefile Targets | ||
``` | ||
Available targets: | ||
help This help screen | ||
help/all Display help for all targets | ||
lint Lint terraform code | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|:----:|:-----:|:-----:| | ||
| acm_certificate_arn | Existing ACM Certificate ARN | string | `` | no | | ||
| aliases | List of aliases. CAUTION! Names MUSTN'T contain trailing `.` | list | `<list>` | no | | ||
| allowed_methods | List of allowed methods (e.g. ` GET, PUT, POST, DELETE, HEAD`) for AWS CloudFront | list | `<list>` | no | | ||
| attributes | Additional attributes (e.g. `policy` or `role`) | list | `<list>` | no | | ||
| cache_behavior | List of cache behaviors to implement | list | `<list>` | no | | ||
| cached_methods | List of cached methods (e.g. ` GET, PUT, POST, DELETE, HEAD`) | list | `<list>` | no | | ||
| comment | Comment for the origin access identity | string | `Managed by Terraform` | no | | ||
| compress | (Optional) Whether you want CloudFront to automatically compress content for web requests that include Accept-Encoding: gzip in the request header (default: false) | string | `false` | no | | ||
| custom_error_response | (Optional) - List of one or more custom error response element maps | list | `<list>` | no | | ||
| default_root_object | Object that CloudFront return when requests the root URL | string | `index.html` | no | | ||
| default_ttl | Default amount of time (in seconds) that an object is in a CloudFront cache | string | `60` | no | | ||
| delimiter | Delimiter to be used between `name`, `namespace`, `stage`, etc. | string | `-` | no | | ||
| enabled | Set to false to prevent the module from creating any resources | string | `true` | no | | ||
| forward_cookies | Specifies whether you want CloudFront to forward cookies to the origin. Valid options are all, none or whitelist | string | `none` | no | | ||
| forward_cookies_whitelisted_names | List of forwarded cookie names | list | `<list>` | no | | ||
| forward_headers | Specifies the Headers, if any, that you want CloudFront to vary upon for this cache behavior. Specify `*` to include all headers. | list | `<list>` | no | | ||
| forward_query_string | Forward query strings to the origin that is associated with this cache behavior | string | `false` | no | | ||
| geo_restriction_locations | List of country codes for which CloudFront either to distribute content (whitelist) or not distribute your content (blacklist) | list | `<list>` | no | | ||
| geo_restriction_type | Method that use to restrict distribution of your content by country: `none`, `whitelist`, or `blacklist` | string | `none` | no | | ||
| is_ipv6_enabled | State of CloudFront IPv6 | string | `true` | no | | ||
| log_expiration_days | Number of days after which to expunge the objects | string | `90` | no | | ||
| log_glacier_transition_days | Number of days after which to move the data to the glacier storage tier | string | `60` | no | | ||
| log_include_cookies | Include cookies in access logs | string | `false` | no | | ||
| log_prefix | Path of logs in S3 bucket | string | `` | no | | ||
| log_standard_transition_days | Number of days to persist in the standard storage tier before moving to the glacier tier | string | `30` | no | | ||
| max_ttl | Maximum amount of time (in seconds) that an object is in a CloudFront cache | string | `31536000` | no | | ||
| min_ttl | Minimum amount of time that you want objects to stay in CloudFront caches | string | `0` | no | | ||
| name | Name (e.g. `bastion` or `db`) | string | - | yes | | ||
| namespace | Namespace (e.g. `cp` or `cloudposse`) | string | - | yes | | ||
| origin_domain_name | (Required) - The DNS domain name of your custom origin (e.g. website) | string | `` | no | | ||
| origin_http_port | (Required) - The HTTP port the custom origin listens on | string | `80` | no | | ||
| origin_https_port | (Required) - The HTTPS port the custom origin listens on | string | `443` | no | | ||
| origin_keepalive_timeout | (Optional) The Custom KeepAlive timeout, in seconds. By default, AWS enforces a limit of 60. But you can request an increase. | string | `60` | no | | ||
| origin_path | (Optional) - An optional element that causes CloudFront to request your content from a directory in your Amazon S3 bucket or your custom origin | string | `` | no | | ||
| origin_protocol_policy | (Required) - The origin protocol policy to apply to your origin. One of http-only, https-only, or match-viewer | string | `match-viewer` | no | | ||
| origin_read_timeout | (Optional) The Custom Read timeout, in seconds. By default, AWS enforces a limit of 60. But you can request an increase. | string | `60` | no | | ||
| origin_ssl_protocols | (Required) - The SSL/TLS protocols that you want CloudFront to use when communicating with your origin over HTTPS | list | `<list>` | no | | ||
| parent_zone_id | ID of the hosted zone to contain this record (or specify `parent_zone_name`) | string | `` | no | | ||
| parent_zone_name | Name of the hosted zone to contain this record (or specify `parent_zone_id`) | string | `` | no | | ||
| price_class | Price class for this distribution: `PriceClass_All`, `PriceClass_200`, `PriceClass_100` | string | `PriceClass_100` | no | | ||
| stage | Stage (e.g. `prod`, `dev`, `staging`) | string | - | yes | | ||
| tags | Additional tags (e.g. `map('BusinessUnit','XYZ')`) | map | `<map>` | no | | ||
| viewer_minimum_protocol_version | (Optional) The minimum version of the SSL protocol that you want CloudFront to use for HTTPS connections. | string | `TLSv1` | no | | ||
| viewer_protocol_policy | allow-all, redirect-to-https | string | `redirect-to-https` | no | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| cf_aliases | Extra CNAMEs of AWS CloudFront | | ||
| cf_arn | ID of AWS CloudFront distribution | | ||
| cf_domain_name | Domain name corresponding to the distribution | | ||
| cf_etag | Current version of the distribution's information | | ||
| cf_hosted_zone_id | CloudFront Route 53 zone ID | | ||
| cf_id | ID of AWS CloudFront distribution | | ||
| cf_origin_access_identity | A shortcut to the full path for the origin access identity to use in CloudFront | | ||
| cf_status | Current status of the distribution | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,39 @@ | ||
output "cf_id" { | ||
value = "${aws_cloudfront_distribution.default.id}" | ||
value = "${aws_cloudfront_distribution.default.id}" | ||
description = "ID of AWS CloudFront distribution" | ||
} | ||
|
||
output "cf_arn" { | ||
value = "${aws_cloudfront_distribution.default.arn}" | ||
value = "${aws_cloudfront_distribution.default.arn}" | ||
description = "ID of AWS CloudFront distribution" | ||
} | ||
|
||
output "cf_aliases" { | ||
value = "${aws_cloudfront_distribution.default.aliases}" | ||
value = "${aws_cloudfront_distribution.default.aliases}" | ||
description = "Extra CNAMEs of AWS CloudFront" | ||
} | ||
|
||
output "cf_status" { | ||
value = "${aws_cloudfront_distribution.default.status}" | ||
value = "${aws_cloudfront_distribution.default.status}" | ||
description = "Current status of the distribution" | ||
} | ||
|
||
output "cf_domain_name" { | ||
value = "${aws_cloudfront_distribution.default.domain_name}" | ||
value = "${aws_cloudfront_distribution.default.domain_name}" | ||
description = "Domain name corresponding to the distribution" | ||
} | ||
|
||
output "cf_etag" { | ||
value = "${aws_cloudfront_distribution.default.etag}" | ||
value = "${aws_cloudfront_distribution.default.etag}" | ||
description = "Current version of the distribution's information" | ||
} | ||
|
||
output "cf_hosted_zone_id" { | ||
value = "${aws_cloudfront_distribution.default.hosted_zone_id}" | ||
value = "${aws_cloudfront_distribution.default.hosted_zone_id}" | ||
description = "CloudFront Route 53 zone ID" | ||
} | ||
|
||
output "cf_origin_access_identity" { | ||
value = "${aws_cloudfront_origin_access_identity.default.cloudfront_access_identity_path}" | ||
value = "${aws_cloudfront_origin_access_identity.default.cloudfront_access_identity_path}" | ||
description = "A shortcut to the full path for the origin access identity to use in CloudFront" | ||
} |
Oops, something went wrong.