Skip to content

Commit 5886bf5

Browse files
committed
fix: Rule priority logic.
1 parent 2cb3174 commit 5886bf5

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ path matching).
382382
For each webhook, you can optionally specify one or more `criteria` that must be
383383
met for the request to be allowed. This can be used to check for specific
384384
headers, query parameters, or other request attributes that are expected for a
385-
valid request. If not criteria are specified, any requests matching the paths
385+
valid request. If no criteria are specified, any requests matching the paths
386386
will be allowed through.
387387

388388
| Name | Description | Type | Default | Required |

main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ resource "aws_wafv2_web_acl" "waf" {
133133
for_each = var.ip_set_rules
134134
content {
135135
name = coalesce(rule.value.name, join("-", [local.prefix, "ip", rule.key]))
136-
priority = rule.value.priority != null ? rule.value.priority : index(var.ip_set_rules, rule.key)
136+
priority = rule.value.priority != null ? rule.value.priority : index(keys(var.ip_set_rules), rule.key)
137137

138138
action {
139139
dynamic "allow" {
@@ -206,7 +206,7 @@ resource "aws_wafv2_web_acl" "waf" {
206206
for_each = var.rate_limit_rules
207207
content {
208208
name = coalesce(rule.value.name, join("-", [local.prefix, "rate", rule.key]))
209-
priority = rule.value.priority != null ? rule.value.priority : index(var.ip_set_rules, rule.key) + length(var.ip_set_rules) + 1
209+
priority = rule.value.priority != null ? rule.value.priority : index(keys(var.rate_limit_rules), rule.key) + length(var.ip_set_rules) + 1
210210

211211
action {
212212
dynamic "allow" {

0 commit comments

Comments
 (0)