Skip to content

Commit f266212

Browse files
authored
Merge pull request #44987 from tabito-hara/b-aws_wafv2_web_acl_logging_configuration-fix_regex_validation
[bugfix] aws_wafv2_web_acl_logging_configuration: Fix validation for redacted_fields.single_header.name
2 parents f735bbb + b45c4db commit f266212

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

.changelog/44987.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
resource/aws_wafv2_web_acl_logging_configuration: Fix the validation for `redacted_fields.single_header.name`
3+
```

internal/service/wafv2/web_acl_logging_configuration.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,10 @@ func resourceWebACLLoggingConfiguration() *schema.Resource {
148148
Type: schema.TypeString,
149149
Required: true,
150150
ValidateFunc: validation.All(
151-
validation.StringLenBetween(1, 40),
151+
validation.StringLenBetween(1, 64),
152152
// The value is returned in lower case by the API.
153153
// Trying to solve it with StateFunc and/or DiffSuppressFunc resulted in hash problem of the rule field or didn't work.
154-
validation.StringMatch(regexache.MustCompile(`^[0-9a-z_-]+$`), "must contain only lowercase alphanumeric characters, underscores, and hyphens"),
154+
validation.StringMatch(regexache.MustCompile(`^.*\S.*$`), "Must be any string that contains at least one non-whitespace character"),
155155
),
156156
},
157157
},

internal/service/wafv2/web_acl_logging_configuration_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func TestAccWAFV2WebACLLoggingConfiguration_updateSingleHeaderRedactedField(t *t
8181
resource.TestCheckResourceAttr(resourceName, "log_destination_configs.#", "1"),
8282
resource.TestCheckResourceAttr(resourceName, "redacted_fields.#", "2"),
8383
resource.TestCheckTypeSetElemNestedAttrs(resourceName, "redacted_fields.*", map[string]string{
84-
"single_header.0.name": "referer",
84+
"single_header.0.name": "sso.csrf",
8585
}),
8686
resource.TestCheckTypeSetElemNestedAttrs(resourceName, "redacted_fields.*", map[string]string{
8787
"single_header.0.name": "user-agent",
@@ -801,7 +801,7 @@ resource "aws_wafv2_web_acl_logging_configuration" "test" {
801801
802802
redacted_fields {
803803
single_header {
804-
name = "referer"
804+
name = "sso.csrf"
805805
}
806806
}
807807

0 commit comments

Comments
 (0)