|
3 | 3 |
|
4 | 4 | [![Cloud Posse][logo]](https://cpco.io/homepage) |
5 | 5 |
|
6 | | -# terraform-aws-cloudfront-s3-cdn [](https://travis-ci.org/cloudposse/terraform-aws-cloudfront-s3-cdn) [](https://travis-ci.org/cloudposse/terraform-aws-cloudfront-s3-cdn/releases) [](https://slack.cloudposse.com) |
| 6 | +# terraform-aws-cloudfront-s3-cdn [](https://g.codefresh.io/public/accounts/cloudposse/pipelines/5d169121757962ff25679794) [](https://travis-ci.org/cloudposse/terraform-aws-cloudfront-s3-cdn/releases) [](https://slack.cloudposse.com) |
7 | 7 |
|
8 | 8 |
|
9 | 9 | Terraform module to provision an AWS CloudFront CDN with an S3 origin. |
@@ -42,6 +42,11 @@ We literally have [*hundreds of terraform modules*][terraform_modules] that are |
42 | 42 |
|
43 | 43 | ## Usage |
44 | 44 |
|
| 45 | + |
| 46 | +**IMPORTANT:** The `master` branch is used in `source` just as an example. In your code, do not pin to `master` because there may be breaking changes between releases. |
| 47 | +Instead pin to the release tag (e.g. `?ref=tags/x.y.z`) of one of our [latest releases](https://github.com/cloudposse/terraform-aws-cloudfront-s3-cdn/releases). |
| 48 | + |
| 49 | + |
45 | 50 | ```hcl |
46 | 51 | module "cdn" { |
47 | 52 | source = "git::https://github.com/cloudposse/terraform-aws-cloudfront-s3-cdn.git?ref=master" |
@@ -100,54 +105,54 @@ Available targets: |
100 | 105 | | Name | Description | Type | Default | Required | |
101 | 106 | |------|-------------|:----:|:-----:|:-----:| |
102 | 107 | | acm_certificate_arn | Existing ACM Certificate ARN | string | `` | no | |
103 | | -| aliases | List of FQDN's - Used to set the Alternate Domain Names (CNAMEs) setting on Cloudfront | list | `<list>` | no | |
104 | | -| allowed_methods | List of allowed methods (e.g. GET, PUT, POST, DELETE, HEAD) for AWS CloudFront | list | `<list>` | no | |
105 | | -| attributes | Additional attributes (e.g. `1`) | list | `<list>` | no | |
| 108 | +| aliases | List of FQDN's - Used to set the Alternate Domain Names (CNAMEs) setting on Cloudfront | list(string) | `<list>` | no | |
| 109 | +| allowed_methods | List of allowed methods (e.g. GET, PUT, POST, DELETE, HEAD) for AWS CloudFront | list(string) | `<list>` | no | |
| 110 | +| attributes | Additional attributes (e.g. `1`) | list(string) | `<list>` | no | |
106 | 111 | | bucket_domain_format | Format of bucket domain name | string | `%s.s3.amazonaws.com` | no | |
107 | | -| cached_methods | List of cached methods (e.g. GET, PUT, POST, DELETE, HEAD) | list | `<list>` | no | |
| 112 | +| cached_methods | List of cached methods (e.g. GET, PUT, POST, DELETE, HEAD) | list(string) | `<list>` | no | |
108 | 113 | | comment | Comment for the origin access identity | string | `Managed by Terraform` | no | |
109 | | -| compress | Compress content for web requests that include Accept-Encoding: gzip in the request header | string | `false` | no | |
110 | | -| cors_allowed_headers | List of allowed headers for S3 bucket | list | `<list>` | no | |
111 | | -| cors_allowed_methods | List of allowed methods (e.g. GET, PUT, POST, DELETE, HEAD) for S3 bucket | list | `<list>` | no | |
112 | | -| cors_allowed_origins | List of allowed origins (e.g. example.com, test.com) for S3 bucket | list | `<list>` | no | |
113 | | -| cors_expose_headers | List of expose header in the response for S3 bucket | list | `<list>` | no | |
| 114 | +| compress | Compress content for web requests that include Accept-Encoding: gzip in the request header | bool | `false` | no | |
| 115 | +| cors_allowed_headers | List of allowed headers for S3 bucket | list(string) | `<list>` | no | |
| 116 | +| cors_allowed_methods | List of allowed methods (e.g. GET, PUT, POST, DELETE, HEAD) for S3 bucket | list(string) | `<list>` | no | |
| 117 | +| cors_allowed_origins | List of allowed origins (e.g. example.com, test.com) for S3 bucket | list(string) | `<list>` | no | |
| 118 | +| cors_expose_headers | List of expose header in the response for S3 bucket | list(string) | `<list>` | no | |
114 | 119 | | cors_max_age_seconds | Time in seconds that browser can cache the response for S3 bucket | string | `3600` | no | |
115 | | -| custom_error_response | List of one or more custom error response element maps | list | `<list>` | no | |
| 120 | +| custom_error_response | List of one or more custom error response element maps | object | `<list>` | no | |
116 | 121 | | default_root_object | Object that CloudFront return when requests the root URL | string | `index.html` | no | |
117 | 122 | | default_ttl | Default amount of time (in seconds) that an object is in a CloudFront cache | string | `60` | no | |
118 | 123 | | delimiter | Delimiter to be used between `namespace`, `stage`, `name` and `attributes` | string | `-` | no | |
119 | | -| enabled | Select Enabled if you want CloudFront to begin processing requests as soon as the distribution is created, or select Disabled if you do not want CloudFront to begin processing requests after the distribution is created. | string | `true` | no | |
| 124 | +| enabled | Select Enabled if you want CloudFront to begin processing requests as soon as the distribution is created, or select Disabled if you do not want CloudFront to begin processing requests after the distribution is created. | bool | `true` | no | |
120 | 125 | | forward_cookies | Time in seconds that browser can cache the response for S3 bucket | string | `none` | no | |
121 | | -| forward_header_values | A list of whitelisted header values to forward to the origin | list | `<list>` | no | |
122 | | -| forward_query_string | Forward query strings to the origin that is associated with this cache behavior | string | `false` | no | |
123 | | -| geo_restriction_locations | List of country codes for which CloudFront either to distribute content (whitelist) or not distribute your content (blacklist) | list | `<list>` | no | |
| 126 | +| forward_header_values | A list of whitelisted header values to forward to the origin | list(string) | `<list>` | no | |
| 127 | +| forward_query_string | Forward query strings to the origin that is associated with this cache behavior | bool | `false` | no | |
| 128 | +| geo_restriction_locations | List of country codes for which CloudFront either to distribute content (whitelist) or not distribute your content (blacklist) | list(string) | `<list>` | no | |
124 | 129 | | geo_restriction_type | Method that use to restrict distribution of your content by country: `none`, `whitelist`, or `blacklist` | string | `none` | no | |
125 | | -| is_ipv6_enabled | State of CloudFront IPv6 | string | `true` | no | |
126 | | -| lambda_function_association | A config block that triggers a lambda function with specific actions | list | `<list>` | no | |
| 130 | +| is_ipv6_enabled | State of CloudFront IPv6 | bool | `true` | no | |
| 131 | +| lambda_function_association | A config block that triggers a lambda function with specific actions | object | `<list>` | no | |
127 | 132 | | log_expiration_days | Number of days after which to expunge the objects | string | `90` | no | |
128 | 133 | | log_glacier_transition_days | Number of days after which to move the data to the glacier storage tier | string | `60` | no | |
129 | | -| log_include_cookies | Include cookies in access logs | string | `false` | no | |
| 134 | +| log_include_cookies | Include cookies in access logs | bool | `false` | no | |
130 | 135 | | log_prefix | Path of logs in S3 bucket | string | `` | no | |
131 | 136 | | log_standard_transition_days | Number of days to persist in the standard storage tier before moving to the glacier tier | string | `30` | no | |
132 | 137 | | max_ttl | Maximum amount of time (in seconds) that an object is in a CloudFront cache | string | `31536000` | no | |
133 | 138 | | min_ttl | Minimum amount of time that you want objects to stay in CloudFront caches | string | `0` | no | |
134 | 139 | | minimum_protocol_version | Cloudfront TLS minimum protocol version | string | `TLSv1` | no | |
135 | 140 | | name | Name (e.g. `bastion` or `app`) | string | - | yes | |
136 | | -| namespace | Namespace (e.g. `eg` or `cp`) | string | - | yes | |
| 141 | +| namespace | Namespace (e.g. `eg` or `cp`) | string | `` | no | |
137 | 142 | | null | an empty string | string | `` | no | |
138 | | -| origin_bucket | Name of S3 bucket | string | `` | no | |
139 | | -| origin_force_destroy | Delete all objects from the bucket so that the bucket can be destroyed without error (e.g. `true` or `false`) | string | `false` | no | |
| 143 | +| origin_bucket | Origin S3 bucket name | string | `` | no | |
| 144 | +| origin_force_destroy | Delete all objects from the bucket so that the bucket can be destroyed without error (e.g. `true` or `false`) | bool | `false` | no | |
140 | 145 | | origin_path | An optional element that causes CloudFront to request your content from a directory in your Amazon S3 bucket or your custom origin. It must begin with a /. Do not add a / at the end of the path. | string | `` | no | |
141 | 146 | | parent_zone_id | ID of the hosted zone to contain this record (or specify `parent_zone_name`) | string | `` | no | |
142 | 147 | | parent_zone_name | Name of the hosted zone to contain this record (or specify `parent_zone_id`) | string | `` | no | |
143 | 148 | | price_class | Price class for this distribution: `PriceClass_All`, `PriceClass_200`, `PriceClass_100` | string | `PriceClass_100` | no | |
144 | | -| stage | Stage (e.g. `prod`, `dev`, `staging`) | string | - | yes | |
| 149 | +| stage | Stage (e.g. `prod`, `dev`, `staging`) | string | `` | no | |
145 | 150 | | static_s3_bucket | aws-cli is a bucket owned by amazon that will perminantly exist. It allows for the data source to be called during the destruction process without failing. It doesn't get used for anything else, this is a safe workaround for handling the fact that if a data source like the one `aws_s3_bucket.selected` gets an error, you can't continue the terraform process which also includes the 'destroy' command, where is doesn't even need this data source! Don't change this bucket name, it's a variable so that we can provide this description. And this works around a problem that is an edge case. | string | `aws-cli` | no | |
146 | | -| tags | Additional tags (e.g. map(`BusinessUnit`,`XYZ`) | map | `<map>` | no | |
147 | | -| trusted_signers | The AWS accounts, if any, that you want to allow to create signed URLs for private content. 'self' is acceptable. | list | `<list>` | no | |
148 | | -| use_regional_s3_endpoint | When set to 'true' the s3 origin_bucket will use the regional endpoint address instead of the global endpoint address | string | `false` | no | |
| 151 | +| tags | Additional tags (e.g. map(`BusinessUnit`,`XYZ`) | map(string) | `<map>` | no | |
| 152 | +| trusted_signers | The AWS accounts, if any, that you want to allow to create signed URLs for private content. 'self' is acceptable. | list(string) | `<list>` | no | |
| 153 | +| use_regional_s3_endpoint | When set to 'true' the s3 origin_bucket will use the regional endpoint address instead of the global endpoint address | bool | `false` | no | |
149 | 154 | | viewer_protocol_policy | allow-all, redirect-to-https | string | `redirect-to-https` | no | |
150 | | -| wait_for_deployment | When set to 'true' the resource will wait for the distribution status to change from InProgress to Deployed | string | `true` | no | |
| 155 | +| wait_for_deployment | When set to 'true' the resource will wait for the distribution status to change from InProgress to Deployed | bool | `true` | no | |
151 | 156 | | web_acl_id | ID of the AWS WAF web ACL that is associated with the distribution | string | `` | no | |
152 | 157 |
|
153 | 158 | ## Outputs |
|
0 commit comments