@@ -125,11 +125,13 @@ resource "aws_wafv2_web_acl" "web_acl" {
125125 # This rule is a pre-configured rule set from AWS
126126 # that protects against common exploits like SQLi and XSS.
127127 rule {
128- name = " AWS-AWSManagedRulesCommonRuleSet"
128+ # Use a unique name for this rule
129+ name = " CommonRuleSet"
129130 priority = 1
130131 statement {
131132 managed_rule_group_statement {
132133 vendor_name = " AWS"
134+ # This is the correct managed rule group name from AWS
133135 name = " AWSManagedRulesCommonRuleSet"
134136 }
135137 }
@@ -139,18 +141,20 @@ resource "aws_wafv2_web_acl" "web_acl" {
139141 }
140142 visibility_config {
141143 cloudwatch_metrics_enabled = true
142- metric_name = " CommonRuleSet "
144+ metric_name = " CommonRuleSetMetrics " # Must be unique
143145 sampled_requests_enabled = true
144146 }
145147 }
146148
147- # Rule to protect against Log4j2 vulnerabilities
149+ # Rule to protect against Log4j2 vulnerabilities and other bad inputs
148150 rule {
149- name = " AWS-AWSManagedRulesKnownBadInputsRuleSet"
151+ # Use a unique name for this rule
152+ name = " KnownBadInputs"
150153 priority = 2
151154 statement {
152155 managed_rule_group_statement {
153156 vendor_name = " AWS"
157+ # This is the correct managed rule group name from AWS
154158 name = " AWSManagedRulesKnownBadInputsRuleSet"
155159 }
156160 }
@@ -159,7 +163,7 @@ resource "aws_wafv2_web_acl" "web_acl" {
159163 }
160164 visibility_config {
161165 cloudwatch_metrics_enabled = true
162- metric_name = " KnownBadInputsRuleSet "
166+ metric_name = " KnownBadInputsMetrics " # Must be unique
163167 sampled_requests_enabled = true
164168 }
165169 }
@@ -175,4 +179,4 @@ resource "aws_wafv2_web_acl" "web_acl" {
175179resource "aws_wafv2_web_acl_association" "web_acl_assoc" {
176180 resource_arn = aws_lb. web_alb . arn
177181 web_acl_arn = aws_wafv2_web_acl. web_acl . arn
178- }
182+ }
0 commit comments