Skip to content

Commit 00e4581

Browse files
committed
Trim cleanup
1 parent 972e068 commit 00e4581

File tree

1 file changed

+13
-4
lines changed
  • operations/deployment/terraform/modules/aws/waf

1 file changed

+13
-4
lines changed

operations/deployment/terraform/modules/aws/waf/aws_waf.tf

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
locals {
22
aws_waf_rule_geo_block_countries = var.aws_waf_rule_geo_block_countries != "" ? [
3-
for n in split(",", var.aws_waf_rule_geo_block_countries) : trim(n)
3+
for n in split(",", var.aws_waf_rule_geo_block_countries) : (n)
44
] : []
55

66
aws_waf_rule_geo_allow_only_countries = var.aws_waf_rule_geo_allow_only_countries != "" ? [
7-
for n in split(",", var.aws_waf_rule_geo_allow_only_countries) : trim(n)
7+
for n in split(",", var.aws_waf_rule_geo_allow_only_countries) : (n)
88
] : []
99
}
1010

@@ -242,7 +242,7 @@ resource "aws_wafv2_web_acl" "waf" {
242242

243243
statement {
244244
rule_group_reference_statement {
245-
arn = var.aws_waf_rule_user_arn
245+
arn = data.aws_wafv2_rule_group.user_provided[0].arn
246246
}
247247
}
248248

@@ -413,4 +413,13 @@ output "waf_web_acl_arn" {
413413

414414
output "waf_web_acl_id" {
415415
value = var.aws_waf_enable ? aws_wafv2_web_acl.waf[0].id : null
416-
}
416+
}
417+
418+
# Read rule group by name
419+
data "aws_wafv2_rule_group" "example" {
420+
count = var.aws_waf_rule_user_arn != "" ? [1] : []
421+
name = "var.aws_waf_rule_user_arn"
422+
scope = "REGIONAL"
423+
}
424+
425+
arn:aws:wafv2:us-east-1:755521597925:regional/rulegroup/some/351a2738-39ae-4d00-a864-599d6b3dc225

0 commit comments

Comments
 (0)