From 9d75cc272b4c4d988ae90cf80015e9e602f4b095 Mon Sep 17 00:00:00 2001 From: Nuno Fernandes Date: Tue, 18 Jul 2023 13:16:59 +0100 Subject: [PATCH] Fix nested required `text_transformation` and go back to previous behaviour (#113) After https://github.com/umotif-public/terraform-aws-waf-webaclv2/pull/104, a bug was introduced that would require a nested `text_transformation`. As it wasn't done across the entire module, it has different behaviours on different use-cases. This fixes that bug and reverts to the previous behaviour. --- main.tf | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/main.tf b/main.tf index c446d1d..40b23cc 100644 --- a/main.tf +++ b/main.tf @@ -2122,8 +2122,8 @@ resource "aws_wafv2_web_acl" "main" { positional_constraint = lookup(byte_match_statement.value, "positional_constraint") search_string = lookup(byte_match_statement.value, "search_string") text_transformation { - priority = lookup(byte_match_statement.value["text_transformation"], "priority") - type = lookup(byte_match_statement.value["text_transformation"], "type") + priority = lookup(byte_match_statement.value, "priority") + type = lookup(byte_match_statement.value, "type") } } } @@ -2457,8 +2457,8 @@ resource "aws_wafv2_web_acl" "main" { } } text_transformation { - priority = lookup(sqli_match_statement.value["text_transformation"], "priority") - type = lookup(sqli_match_statement.value["text_transformation"], "type") + priority = lookup(sqli_match_statement.value, "priority") + type = lookup(sqli_match_statement.value, "type") } } } @@ -2518,8 +2518,8 @@ resource "aws_wafv2_web_acl" "main" { } } text_transformation { - priority = lookup(xss_match_statement.value["text_transformation"], "priority") - type = lookup(xss_match_statement.value["text_transformation"], "type") + priority = lookup(xss_match_statement.value, "priority") + type = lookup(xss_match_statement.value, "type") } } } @@ -3894,8 +3894,8 @@ resource "aws_wafv2_web_acl" "main" { } } text_transformation { - priority = lookup(sqli_match_statement.value["text_transformation"], "priority") - type = lookup(sqli_match_statement.value["text_transformation"], "type") + priority = lookup(sqli_match_statement.value, "priority") + type = lookup(sqli_match_statement.value, "type") } } } @@ -3972,8 +3972,8 @@ resource "aws_wafv2_web_acl" "main" { } } text_transformation { - priority = lookup(xss_match_statement.value["text_transformation"], "priority") - type = lookup(xss_match_statement.value["text_transformation"], "type") + priority = lookup(xss_match_statement.value, "priority") + type = lookup(xss_match_statement.value, "type") } } } @@ -4454,8 +4454,8 @@ resource "aws_wafv2_web_acl" "main" { } } text_transformation { - priority = lookup(sqli_match_statement.value["text_transformation"], "priority") - type = lookup(sqli_match_statement.value["text_transformation"], "type") + priority = lookup(sqli_match_statement.value, "priority") + type = lookup(sqli_match_statement.value, "type") } } } @@ -4532,8 +4532,8 @@ resource "aws_wafv2_web_acl" "main" { } } text_transformation { - priority = lookup(xss_match_statement.value["text_transformation"], "priority") - type = lookup(xss_match_statement.value["text_transformation"], "type") + priority = lookup(xss_match_statement.value, "priority") + type = lookup(xss_match_statement.value, "type") } } } @@ -5183,8 +5183,8 @@ resource "aws_wafv2_web_acl" "main" { } } text_transformation { - priority = lookup(sqli_match_statement.value["text_transformation"], "priority") - type = lookup(sqli_match_statement.value["text_transformation"], "type") + priority = lookup(sqli_match_statement.value, "priority") + type = lookup(sqli_match_statement.value, "type") } } } @@ -5261,8 +5261,8 @@ resource "aws_wafv2_web_acl" "main" { } } text_transformation { - priority = lookup(xss_match_statement.value["text_transformation"], "priority") - type = lookup(xss_match_statement.value["text_transformation"], "type") + priority = lookup(xss_match_statement.value, "priority") + type = lookup(xss_match_statement.value, "type") } } } @@ -6133,8 +6133,8 @@ resource "aws_wafv2_web_acl" "main" { positional_constraint = lookup(byte_match_statement.value, "positional_constraint") search_string = lookup(byte_match_statement.value, "search_string") text_transformation { - priority = lookup(byte_match_statement.value["text_transformation"], "priority") - type = lookup(byte_match_statement.value["text_transformation"], "type") + priority = lookup(byte_match_statement.value, "priority") + type = lookup(byte_match_statement.value, "type") } } } @@ -6211,8 +6211,8 @@ resource "aws_wafv2_web_acl" "main" { } } text_transformation { - priority = lookup(sqli_match_statement.value["text_transformation"], "priority") - type = lookup(sqli_match_statement.value["text_transformation"], "type") + priority = lookup(sqli_match_statement.value, "priority") + type = lookup(sqli_match_statement.value, "type") } } } @@ -6289,8 +6289,8 @@ resource "aws_wafv2_web_acl" "main" { } } text_transformation { - priority = lookup(xss_match_statement.value["text_transformation"], "priority") - type = lookup(xss_match_statement.value["text_transformation"], "type") + priority = lookup(xss_match_statement.value, "priority") + type = lookup(xss_match_statement.value, "type") } } }