@@ -121,78 +121,78 @@ resource "aws_wafv2_web_acl" "cloudfront_waf" {
121
121
}
122
122
}
123
123
124
- # resource "aws_wafv2_web_acl_logging_configuration" "waf_logging" {
125
- # count = var.waf_logging_configuration == null || try(aws_wafv2_web_acl.cloudfront_waf[0], null) = = null ? 0 : 1
126
- #
127
- # resource_arn = aws_wafv2_web_acl.cloudfront_waf[0].arn
128
- # log_destination_configs = var.waf_logging_configuration.log_destination_configs
129
- #
130
- # dynamic "logging_filter" {
131
- # for_each = var.waf_logging_configuration.logging_filter != null ? [true] : []
132
- #
133
- # content {
134
- # default_behavior = var.waf_logging_configuration.logging_filter.default_behavior
135
- #
136
- # dynamic "filter" {
137
- # for_each = toset(var.waf_logging_configuration.logging_filter.filter)
138
- #
139
- # content {
140
- # behavior = filter.value.behavior
141
- # requirement = filter.value.requirement
142
- #
143
- # dynamic "condition" {
144
- # for_each = filter.value.action_condition != null ? toset(filter.value.action_condition) : []
145
- #
146
- # content {
147
- # action_condition {
148
- # action = condition.value.action
149
- # }
150
- # }
151
- # }
152
- #
153
- # dynamic "condition" {
154
- # for_each = filter.value.label_name_condition != null ? toset(filter.label_name_condition) : []
155
- #
156
- # content {
157
- # label_name_condition {
158
- # label_name = condition.value.label_name
159
- # }
160
- # }
161
- # }
162
- # }
163
- # }
164
- # }
165
- # }
166
- #
167
- # dynamic "redacted_fields" {
168
- # for_each = var.waf_logging_configuration.redacted_fields == null ? toset(var.waf_logging_configuration.redacted_fields) : []
169
- #
170
- # content {
171
- # dynamic "method" {
172
- # for_each = redacted_fields.value.method == true ? [true] : []
173
- #
174
- # content {}
175
- # }
176
- #
177
- # dynamic "query_string" {
178
- # for_each = redacted_fields.value.query_string == true ? [true] : []
179
- #
180
- # content {}
181
- # }
182
- #
183
- # dynamic "single_header" {
184
- # for_each = redacted_fields.value.single_header != null ? [true] : []
185
- #
186
- # content {
187
- # name = redacted_fields.value.single_header.name
188
- # }
189
- # }
190
- #
191
- # dynamic "uri_path" {
192
- # for_each = redacted_fields.value.uri_path == true ? [true] : []
193
- #
194
- # content {}
195
- # }
196
- # }
197
- # }
198
- # }
124
+ resource "aws_wafv2_web_acl_logging_configuration" "waf_logging" {
125
+ count = var. waf_logging_configuration == null || var . custom_waf ! = null ? 0 : 1
126
+
127
+ resource_arn = aws_wafv2_web_acl. cloudfront_waf [0 ]. arn
128
+ log_destination_configs = var. waf_logging_configuration . log_destination_configs
129
+
130
+ dynamic "logging_filter" {
131
+ for_each = var. waf_logging_configuration . logging_filter != null ? [true ] : []
132
+
133
+ content {
134
+ default_behavior = var. waf_logging_configuration . logging_filter . default_behavior
135
+
136
+ dynamic "filter" {
137
+ for_each = toset (var. waf_logging_configuration . logging_filter . filter )
138
+
139
+ content {
140
+ behavior = filter. value . behavior
141
+ requirement = filter. value . requirement
142
+
143
+ dynamic "condition" {
144
+ for_each = filter. value . action_condition != null ? toset (filter. value . action_condition ) : []
145
+
146
+ content {
147
+ action_condition {
148
+ action = condition. value . action
149
+ }
150
+ }
151
+ }
152
+
153
+ dynamic "condition" {
154
+ for_each = filter. value . label_name_condition != null ? toset (filter. label_name_condition ) : []
155
+
156
+ content {
157
+ label_name_condition {
158
+ label_name = condition. value . label_name
159
+ }
160
+ }
161
+ }
162
+ }
163
+ }
164
+ }
165
+ }
166
+
167
+ dynamic "redacted_fields" {
168
+ for_each = var. waf_logging_configuration . redacted_fields == null ? toset (var. waf_logging_configuration . redacted_fields ) : []
169
+
170
+ content {
171
+ dynamic "method" {
172
+ for_each = redacted_fields. value . method == true ? [true ] : []
173
+
174
+ content {}
175
+ }
176
+
177
+ dynamic "query_string" {
178
+ for_each = redacted_fields. value . query_string == true ? [true ] : []
179
+
180
+ content {}
181
+ }
182
+
183
+ dynamic "single_header" {
184
+ for_each = redacted_fields. value . single_header != null ? [true ] : []
185
+
186
+ content {
187
+ name = redacted_fields. value . single_header . name
188
+ }
189
+ }
190
+
191
+ dynamic "uri_path" {
192
+ for_each = redacted_fields. value . uri_path == true ? [true ] : []
193
+
194
+ content {}
195
+ }
196
+ }
197
+ }
198
+ }
0 commit comments