Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.1
0.2.0
2 changes: 1 addition & 1 deletion examples/cloudfront-distribution-simple/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ provider "aws" {
module "distribution" {
source = "../../modules/distribution"
# source = "tedilabs/cloudfront/aws//modules/distribution"
# version = "~> 0.1.0"
# version = "~> 0.2.0"

name = "example"
description = "Managed by Terraform."
Expand Down
2 changes: 1 addition & 1 deletion examples/cloudfront-distribution-simple/versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_version = "~> 1.2"
required_version = "~> 1.3"

required_providers {
aws = {
Expand Down
4 changes: 2 additions & 2 deletions modules/distribution/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ No modules.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_default_target_origin"></a> [default\_target\_origin](#input\_default\_target\_origin) | (Required) The ID of existing origin or origin group that you want CloudFront to route requests to when a request matches the path pattern for the default behavior. | `string` | n/a | yes |
| <a name="input_name"></a> [name](#input\_name) | (Required) The name of the CloudWatch log group. | `string` | n/a | yes |
| <a name="input_name"></a> [name](#input\_name) | (Required) The name of the CloudFront distribution. | `string` | n/a | yes |
| <a name="input_aliases"></a> [aliases](#input\_aliases) | (Optional) A list of extra CNAMEs (alternate domain names) that use in URLs for the files served by this distribution. | `set(string)` | `[]` | no |
| <a name="input_custom_origins"></a> [custom\_origins](#input\_custom\_origins) | (Optional) A configuration for custom origins of the distribution. Each key defines a name of each custom origin. Each value of `custom_origins` as defined below.<br> (Required) `host` - The DNS domain name of either the web site of your custom origin.<br> (Optional) `path` - The URL path to append to `host` which the origin domain name for origin requests. Enter the directory path, beginning with a slash (/). Do not add a slash (/) at the end of the path.<br> (Optional) `http_port` - The HTTP port the custom origin listens on. Defaults to `80`.<br> (Optional) `https_port` - The HTTPS port the custom origin listens on. Defaults to `443`.<br> (Optional) `protocol_policy` - The origin protocol policy to apply to your origin. The origin protocol policy determines the protocol (HTTP or HTTPS) that you want CloudFront to use when connecting to the origin. Valid values are `HTTP_ONLY`, `HTTPS_ONLY` or `MATCH_VIEWER`. Defaults to `MATCH_VIEWER`.<br> (Optional) `ssl_security_policy` - The minimum SSL/TLS protocol that CloudFront uses with the origin over HTTPS. Valid values are `SSLv3`, `TLSv1`, `TLSv1.1`, and `TLSv1.2`. Defaults to `TLSv1.1`. Recommend the latest TLS protocol that the origin supports.<br> (Optional) `custom_headers` - A map of custom HTTP headers to include in all requests to the origin. Each key/value is mapping to HTTP header `name`/`value`.<br> (Optional) `origin_shield` - Origin Shield is an additional caching layer that can help reduce the load on your origin and help protect its availability. `origin_shield` block as defined below.<br> (Required) `enabled` - Whether to enable Origin Shield. Defaults to `false`.<br> (Required) `region` - The AWS Region for Origin Shield. To specify a region. For example, specify the US East (Ohio) region as `us-east-2`.<br> (Optional) `connection_attempts` - The number of times that CloudFront attempts to connect to the origin, from `1` to `3`. Defaults to `3`.<br> (Optional) `connection_timeout` - The number of seconds that CloudFront waits for a response from the origin, from `1` to `10`. Defaults to `10`.<br> (Optional) `keepalive_timeout` - The number of seconds that CloudFront maintains an idle connection with the origin, from `1` to `60`. Defaults to `5`.<br> (Optional) `response_timeout` - The number of seconds that CloudFront waits for a response from the origin, from `1` to `60`. Defaults to `30`. | `any` | `{}` | no |
| <a name="input_default_allowed_http_methods"></a> [default\_allowed\_http\_methods](#input\_default\_allowed\_http\_methods) | (Optional) A list of HTTP methods to allow. Controls which HTTP methods CloudFront processes and forwards to your Amazon S3 bucket or your custom origin. Valid values are `["GET", "HEAD"]` or `["GET", "HEAD", "OPTIONS"]`. Defaults to `["GET", "HEAD"]`.`GET`, `HEAD`, `OPTIONS`, `PUT`, `POST`, `PATCH` and `DELETE`. Defaults to `GET` and `HEAD`. | `set(string)` | <pre>[<br> "GET",<br> "HEAD"<br>]</pre> | no |
Expand All @@ -56,7 +56,7 @@ No modules.
| <a name="input_description"></a> [description](#input\_description) | (Optional) The description of the distribution. Any comments you want to include about the distribution. | `string` | `"Managed by Terraform."` | no |
| <a name="input_enabled"></a> [enabled](#input\_enabled) | (Optional) Whether the distribution is enabled to accept end user requests for content. | `bool` | `true` | no |
| <a name="input_error_responses"></a> [error\_responses](#input\_error\_responses) | (Optional) A configurations of custom error responses for the distribution. Each key means the HTTP status code that you want to customize like `404`, `503`. Each value of `error_responses` as defined below.<br> (Optional) `cache_min_ttl` - The minimum TTL(Time-to-live) in seconds that you want HTTP error codes to stay in CloudFront caches before CloudFront queries your origin to see whether the object has been updated. Defaults to `10`.<br> (Optional) `custom_response_code` - The HTTP status code to return to the viewer. CloudFront can return a different status code to the viewer than what it received from the origin.<br> (Optional) `custom_response_path` - The path to the custom error response page. | `any` | `{}` | no |
| <a name="input_http_version"></a> [http\_version](#input\_http\_version) | (Optional) The maximum HTTP version to support on the distribution. Valid values are `HTTP1`, or `HTTP2`. Defaults to `HTTP2`. | `string` | `"HTTP2"` | no |
| <a name="input_http_version"></a> [http\_version](#input\_http\_version) | (Optional) The maximum HTTP version to support on the distribution. Valid values are `HTTP1.1`, `HTTP2`, `HTTP2AND3`, or `HTTP3`. Defaults to `HTTP2`. | `string` | `"HTTP2"` | no |
| <a name="input_ipv6_enabled"></a> [ipv6\_enabled](#input\_ipv6\_enabled) | (Optional) Whether the IPv6 is enabled for the distribution. Defaults to `true`. | `bool` | `true` | no |
| <a name="input_logging_include_cookies"></a> [logging\_include\_cookies](#input\_logging\_include\_cookies) | (Optional) Indicate whether to include cookies in access logs. Defaults to `false`. | `bool` | `false` | no |
| <a name="input_logging_s3_bucket"></a> [logging\_s3\_bucket](#input\_logging\_s3\_bucket) | (Optional) The domain name of the S3 bucket to deliver logs to. Example: `myawslogbucket.s3.amazonaws.com`. | `string` | `""` | no |
Expand Down
6 changes: 4 additions & 2 deletions modules/distribution/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ locals {
"100" = "PriceClass_100"
}
http_version = {
"HTTP1" = "http1"
"HTTP2" = "http2"
"HTTP1.1" = "http1.1"
"HTTP2" = "http2"
"HTTP2AND3" = "http2and3"
"HTTP3" = "http3"
}
ssl_support_method = {
"VIP" = "vip"
Expand Down
8 changes: 4 additions & 4 deletions modules/distribution/variables.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
variable "name" {
description = "(Required) The name of the CloudWatch log group."
description = "(Required) The name of the CloudFront distribution."
type = string
}

Expand Down Expand Up @@ -37,14 +37,14 @@ variable "price_class" {
}

variable "http_version" {
description = "(Optional) The maximum HTTP version to support on the distribution. Valid values are `HTTP1`, or `HTTP2`. Defaults to `HTTP2`."
description = "(Optional) The maximum HTTP version to support on the distribution. Valid values are `HTTP1.1`, `HTTP2`, `HTTP2AND3`, or `HTTP3`. Defaults to `HTTP2`."
type = string
default = "HTTP2"
nullable = false

validation {
condition = contains(["HTTP1", "HTTP2"], var.http_version)
error_message = "Valid values are `HTTP1`, or `HTTP2`."
condition = contains(["HTTP1.1", "HTTP2", "HTTP2AND3", "HTTP3"], var.http_version)
error_message = "Valid values are `HTTP1.1`, `HTTP2`, `HTTP2AND3`, or `HTTP3`."
}
}

Expand Down