Skip to content

Commit f2801a1

Browse files
committed
fix(response-headers-policy): no define remove_headers_config block if var.remove_headers is empty
1 parent 46f82e3 commit f2801a1

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

modules/response-headers-policy/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This module creates following resources.
1616

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

2121
## Modules
2222

modules/response-headers-policy/main.tf

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,16 @@ resource "aws_cloudfront_response_headers_policy" "this" {
6161
}
6262
}
6363

64-
remove_headers_config {
65-
dynamic "items" {
66-
for_each = var.remove_headers
64+
dynamic "remove_headers_config" {
65+
for_each = length(var.remove_headers) > 0 ? ["go"] : []
6766

68-
content {
69-
header = items.value
67+
content {
68+
dynamic "items" {
69+
for_each = var.remove_headers
70+
71+
content {
72+
header = items.value
73+
}
7074
}
7175
}
7276
}

0 commit comments

Comments
 (0)