File tree Expand file tree Collapse file tree 3 files changed +33
-14
lines changed Expand file tree Collapse file tree 3 files changed +33
-14
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,11 @@ module "wafv2" {
2222 response_code = 404
2323 response_header = [
2424 {
25- name = " X-Custom-Response-Header-01"
25+ name = " X-Custom-Response-Header01"
26+ value = " Not authorized"
27+ },
28+ {
29+ name = " X-Custom-Response-Header02"
2630 value = " Not authorized"
2731 }
2832 ]
@@ -38,11 +42,18 @@ module "wafv2" {
3842 }
3943 ]
4044
41- custom_response_body = {
42- key = " CustomResponseBody" ,
43- content = " Not authorized" ,
44- content_type = " TEXT_PLAIN"
45- }
45+ custom_response_body = [
46+ {
47+ key = " CustomResponseBody1" ,
48+ content = " Not authorized1" ,
49+ content_type = " TEXT_PLAIN"
50+ },
51+ {
52+ key = " CustomResponseBody2" ,
53+ content = " Not authorized2" ,
54+ content_type = " TEXT_PLAIN"
55+ }
56+ ]
4657
4758 visibility_config = {
4859 cloudwatch_metrics_enabled = false
Original file line number Diff line number Diff line change @@ -77,9 +77,11 @@ resource "aws_wafv2_web_acl" "this" {
7777
7878 dynamic "response_header" {
7979 for_each = lookup(custom_response.value, "response_header", [])
80+ iterator = response_header
81+
8082 content {
81- name = lookup( response_header.value, " name")
82- value = lookup( response_header.value, " value")
83+ name = response_header.value. name
84+ value = response_header.value. value
8385 }
8486 }
8587 }
@@ -12239,11 +12241,13 @@ resource "aws_wafv2_web_acl" "this" {
1223912241 }
1224012242
1224112243 dynamic "custom_response_body" {
12242- for_each = var.custom_response_body
12244+ for_each = var.custom_response_body == null ? [] : var.custom_response_body
12245+ iterator = custom_response_body
12246+
1224312247 content {
12244- content = var. custom_response_body.content
12245- content_type = var. custom_response_body.content_type
12246- key = var. custom_response_body.key
12248+ content = custom_response_body.value .content
12249+ content_type = custom_response_body.value .content_type
12250+ key = custom_response_body.value .key
1224712251 }
1224812252 }
1224912253
Original file line number Diff line number Diff line change @@ -32,8 +32,12 @@ variable "visibility_config" {
3232
3333variable "custom_response_body" {
3434 description = " (Optional) Defines custom response bodies that can be referenced by custom_response actions."
35- type = map (any )
36- default = {}
35+ type = list (object ({
36+ content = string
37+ content_type = string
38+ key = string
39+ }))
40+ default = []
3741}
3842
3943variable "captcha_config" {
You can’t perform that action at this time.
0 commit comments