Skip to content

Commit 8781f78

Browse files
authored
Update cloudfront policies module (#26)
1 parent 50dead6 commit 8781f78

File tree

11 files changed

+69
-39
lines changed

11 files changed

+69
-39
lines changed

modules/cache-policy/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ This module creates following resources.
99

1010
| Name | Version |
1111
|------|---------|
12-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.5 |
13-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.22 |
12+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.6 |
13+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.19 |
1414

1515
## Providers
1616

1717
| Name | Version |
1818
|------|---------|
19-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.19.0 |
19+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.28.0 |
2020

2121
## Modules
2222

modules/cache-policy/versions.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
terraform {
2-
required_version = ">= 1.5"
2+
required_version = ">= 1.6"
33

44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 4.22"
7+
version = ">= 5.19"
88
}
99
}
1010
}

modules/origin-request-policy/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ This module creates following resources.
99

1010
| Name | Version |
1111
|------|---------|
12-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.5 |
13-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.22 |
12+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.6 |
13+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.19 |
1414

1515
## Providers
1616

1717
| Name | Version |
1818
|------|---------|
19-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.19.0 |
19+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.28.0 |
2020

2121
## Modules
2222

@@ -34,9 +34,9 @@ No modules.
3434
|------|-------------|------|---------|:--------:|
3535
| <a name="input_name"></a> [name](#input\_name) | (Required) A unique name to identify the CloudFront Origin Request Policy. | `string` | n/a | yes |
3636
| <a name="input_description"></a> [description](#input\_description) | (Optional) The description of the origin request policy. | `string` | `"Managed by Terraform."` | no |
37-
| <a name="input_forwarding_cookies"></a> [forwarding\_cookies](#input\_forwarding\_cookies) | (Optional) A configuration for specifying which cookies in viewer requests to be forwarded in the origin requests. `forwarding_cookies` as defined below.<br> (Required) `behavior` - Determine whether any cookies in viewer requests are forwarded in the origin requests. Valid values are `NONE`, `WHITELIST`, `ALL`. Defaults to `NONE`.<br> (Optional) `items` - A list of cookie names. It only takes effect when `behavior` is `WHITELIST`. | <pre>object({<br> behavior = optional(string, "NONE")<br> items = optional(set(string), [])<br> })</pre> | `{}` | no |
38-
| <a name="input_forwarding_headers"></a> [forwarding\_headers](#input\_forwarding\_headers) | (Optional) A configuration for specifying which headers in viewer requests to be forwarded in the origin requests. `forwarding_headers` as defined below.<br> (Required) `behavior` - Determine whether any headers in viewer requests are forwarded in the origin requests. Valid values are `NONE`, `WHITELIST`, `ALL_VIEWER` and `ALL_VIEWER_AND_CLOUDFRONT_WHITELIST`. Defaults to `NONE`.<br> (Optional) `items` - A list of header names. It only takes effect when `behavior` is `WHITELIST` or `ALL_VIEWER_AND_CLOUDFRONT_WHITELIST`. | <pre>object({<br> behavior = optional(string, "NONE")<br> items = optional(set(string), [])<br> })</pre> | `{}` | no |
39-
| <a name="input_forwarding_query_strings"></a> [forwarding\_query\_strings](#input\_forwarding\_query\_strings) | (Optional) A configuration for specifying which query strings in viewer requests to be forwarded in the origin requests. `forwarding_query_strings` as defined below.<br> (Required) `behavior` - Determine whether any query strings in viewer requests are forwarded in the origin requests. Valid values are `NONE`, `WHITELIST`, `ALL`. Defaults to `NONE`.<br> (Optional) `items` - A list of query string names. It only takes effect when `behavior` is `WHITELIST`. | <pre>object({<br> behavior = optional(string, "NONE")<br> items = optional(set(string), [])<br> })</pre> | `{}` | no |
37+
| <a name="input_forwarding_cookies"></a> [forwarding\_cookies](#input\_forwarding\_cookies) | (Optional) A configuration for specifying which cookies in viewer requests to be forwarded in the origin requests. `forwarding_cookies` as defined below.<br> (Required) `behavior` - Determine whether any cookies in viewer requests are forwarded in the origin requests. Valid values are `NONE`, `WHITELIST`, `ALL`, `BLACKLIST`. Defaults to `NONE`.<br> (Optional) `items` - A list of cookie names. It only takes effect when `behavior` are `WHITELIST`, `BLACKLIST`. | <pre>object({<br> behavior = optional(string, "NONE")<br> items = optional(set(string), [])<br> })</pre> | `{}` | no |
38+
| <a name="input_forwarding_headers"></a> [forwarding\_headers](#input\_forwarding\_headers) | (Optional) A configuration for specifying which headers in viewer requests to be forwarded in the origin requests. `forwarding_headers` as defined below.<br> (Required) `behavior` - Determine whether any headers in viewer requests are forwarded in the origin requests. Valid values are `NONE`, `WHITELIST`, `BLACKLIST`, `ALL_VIEWER` and `ALL_VIEWER_AND_CLOUDFRONT_WHITELIST`. Defaults to `NONE`.<br> (Optional) `items` - A list of header names. It only takes effect when `behavior` are `WHITELIST`, `BLACKLIST` or `ALL_VIEWER_AND_CLOUDFRONT_WHITELIST`. | <pre>object({<br> behavior = optional(string, "NONE")<br> items = optional(set(string), [])<br> })</pre> | `{}` | no |
39+
| <a name="input_forwarding_query_strings"></a> [forwarding\_query\_strings](#input\_forwarding\_query\_strings) | (Optional) A configuration for specifying which query strings in viewer requests to be forwarded in the origin requests. `forwarding_query_strings` as defined below.<br> (Required) `behavior` - Determine whether any query strings in viewer requests are forwarded in the origin requests. Valid values are `NONE`, `WHITELIST`, `BLACKLIST`, `ALL`. Defaults to `NONE`.<br> (Optional) `items` - A list of query string names. It only takes effect when `behavior` are `WHITELIST`, `BLACKLIST`. | <pre>object({<br> behavior = optional(string, "NONE")<br> items = optional(set(string), [])<br> })</pre> | `{}` | no |
4040

4141
## Outputs
4242

modules/origin-request-policy/main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ resource "aws_cloudfront_origin_request_policy" "this" {
3131
cookie_behavior = local.behaviors[var.forwarding_cookies.behavior]
3232

3333
dynamic "cookies" {
34-
for_each = contains(["WHITELIST"], var.forwarding_cookies.behavior) ? [var.forwarding_cookies] : []
34+
for_each = contains(["WHITELIST", "BLACKLIST"], var.forwarding_cookies.behavior) ? [var.forwarding_cookies] : []
3535

3636
content {
3737
items = cookies.value.items
@@ -42,7 +42,7 @@ resource "aws_cloudfront_origin_request_policy" "this" {
4242
header_behavior = local.behaviors[var.forwarding_headers.behavior]
4343

4444
dynamic "headers" {
45-
for_each = contains(["WHITELIST", "ALL_VIEWER_AND_CLOUDFRONT_WHITELIST"], var.forwarding_headers.behavior) ? [var.forwarding_headers] : []
45+
for_each = contains(["WHITELIST", "BLACKLIST", "ALL_VIEWER_AND_CLOUDFRONT_WHITELIST"], var.forwarding_headers.behavior) ? [var.forwarding_headers] : []
4646

4747
content {
4848
items = headers.value.items
@@ -53,7 +53,7 @@ resource "aws_cloudfront_origin_request_policy" "this" {
5353
query_string_behavior = local.behaviors[var.forwarding_query_strings.behavior]
5454

5555
dynamic "query_strings" {
56-
for_each = contains(["WHITELIST"], var.forwarding_query_strings.behavior) ? [var.forwarding_query_strings] : []
56+
for_each = contains(["WHITELIST", "BLACKLIST"], var.forwarding_query_strings.behavior) ? [var.forwarding_query_strings] : []
5757

5858
content {
5959
items = query_strings.value.items

modules/origin-request-policy/variables.tf

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ variable "description" {
1313
variable "forwarding_cookies" {
1414
description = <<EOF
1515
(Optional) A configuration for specifying which cookies in viewer requests to be forwarded in the origin requests. `forwarding_cookies` as defined below.
16-
(Required) `behavior` - Determine whether any cookies in viewer requests are forwarded in the origin requests. Valid values are `NONE`, `WHITELIST`, `ALL`. Defaults to `NONE`.
17-
(Optional) `items` - A list of cookie names. It only takes effect when `behavior` is `WHITELIST`.
16+
(Required) `behavior` - Determine whether any cookies in viewer requests are forwarded in the origin requests. Valid values are `NONE`, `WHITELIST`, `ALL`, `BLACKLIST`. Defaults to `NONE`.
17+
(Optional) `items` - A list of cookie names. It only takes effect when `behavior` are `WHITELIST`, `BLACKLIST`.
1818
EOF
1919
type = object({
2020
behavior = optional(string, "NONE")
@@ -24,16 +24,16 @@ variable "forwarding_cookies" {
2424
nullable = false
2525

2626
validation {
27-
condition = contains(["NONE", "WHITELIST", "ALL"], var.forwarding_cookies.behavior)
28-
error_message = "Valid values for `behavior` are `NONE`, `WHITELIST`, and `ALL`."
27+
condition = contains(["NONE", "WHITELIST", "ALL", "BLACKLIST"], var.forwarding_cookies.behavior)
28+
error_message = "Valid values for `behavior` are `NONE`, `WHITELIST`, `ALL`, and `BLACKLIST`."
2929
}
3030
}
3131

3232
variable "forwarding_headers" {
3333
description = <<EOF
3434
(Optional) A configuration for specifying which headers in viewer requests to be forwarded in the origin requests. `forwarding_headers` as defined below.
35-
(Required) `behavior` - Determine whether any headers in viewer requests are forwarded in the origin requests. Valid values are `NONE`, `WHITELIST`, `ALL_VIEWER` and `ALL_VIEWER_AND_CLOUDFRONT_WHITELIST`. Defaults to `NONE`.
36-
(Optional) `items` - A list of header names. It only takes effect when `behavior` is `WHITELIST` or `ALL_VIEWER_AND_CLOUDFRONT_WHITELIST`.
35+
(Required) `behavior` - Determine whether any headers in viewer requests are forwarded in the origin requests. Valid values are `NONE`, `WHITELIST`, `BLACKLIST`, `ALL_VIEWER` and `ALL_VIEWER_AND_CLOUDFRONT_WHITELIST`. Defaults to `NONE`.
36+
(Optional) `items` - A list of header names. It only takes effect when `behavior` are `WHITELIST`, `BLACKLIST` or `ALL_VIEWER_AND_CLOUDFRONT_WHITELIST`.
3737
EOF
3838
type = object({
3939
behavior = optional(string, "NONE")
@@ -43,16 +43,16 @@ variable "forwarding_headers" {
4343
nullable = false
4444

4545
validation {
46-
condition = contains(["NONE", "WHITELIST", "ALL_VIEWER", "ALL_VIEWER_AND_CLOUDFRONT_WHITELIST"], var.forwarding_headers.behavior)
47-
error_message = "Valid values for `behavior` are `NONE`, `WHITELIST`, `ALL_VIEWER` and `ALL_VIEWER_AND_CLOUDFRONT_WHITELIST`."
46+
condition = contains(["NONE", "WHITELIST", "BLACKLIST", "ALL_VIEWER", "ALL_VIEWER_AND_CLOUDFRONT_WHITELIST"], var.forwarding_headers.behavior)
47+
error_message = "Valid values for `behavior` are `NONE`, `WHITELIST`, `BLACKLIST`, `ALL_VIEWER` and `ALL_VIEWER_AND_CLOUDFRONT_WHITELIST`."
4848
}
4949
}
5050

5151
variable "forwarding_query_strings" {
5252
description = <<EOF
5353
(Optional) A configuration for specifying which query strings in viewer requests to be forwarded in the origin requests. `forwarding_query_strings` as defined below.
54-
(Required) `behavior` - Determine whether any query strings in viewer requests are forwarded in the origin requests. Valid values are `NONE`, `WHITELIST`, `ALL`. Defaults to `NONE`.
55-
(Optional) `items` - A list of query string names. It only takes effect when `behavior` is `WHITELIST`.
54+
(Required) `behavior` - Determine whether any query strings in viewer requests are forwarded in the origin requests. Valid values are `NONE`, `WHITELIST`, `BLACKLIST`, `ALL`. Defaults to `NONE`.
55+
(Optional) `items` - A list of query string names. It only takes effect when `behavior` are `WHITELIST`, `BLACKLIST`.
5656
EOF
5757
type = object({
5858
behavior = optional(string, "NONE")
@@ -62,7 +62,7 @@ variable "forwarding_query_strings" {
6262
nullable = false
6363

6464
validation {
65-
condition = contains(["NONE", "WHITELIST", "ALL"], var.forwarding_query_strings.behavior)
66-
error_message = "Valid values for `behavior` are `NONE`, `WHITELIST`, and `ALL`."
65+
condition = contains(["NONE", "WHITELIST", "BLACKLIST", "ALL"], var.forwarding_query_strings.behavior)
66+
error_message = "Valid values for `behavior` are `NONE`, `WHITELIST`, `BLACKLIST`, and `ALL`."
6767
}
6868
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
terraform {
2-
required_version = ">= 1.5"
2+
required_version = ">= 1.6"
33

44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 4.22"
7+
version = ">= 5.19"
88
}
99
}
1010
}

0 commit comments

Comments
 (0)