Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ATP enable_regex_in_path parameter for login path #33217

Merged
merged 10 commits into from
Aug 30, 2023
3 changes: 3 additions & 0 deletions .changelog/33217.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_wafv2_web_acl: Add `statement.managed_rule_group_statement.managed_rule_group_configs.aws_managed_rules_atp_rule_set.enable_regex_in_path` argument
```
6 changes: 5 additions & 1 deletion internal/service/wafv2/flex.go
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,9 @@ func expandManagedRulesATPRuleSet(tfList []interface{}) *wafv2.AWSManagedRulesAT
LoginPath: aws.String(m["login_path"].(string)),
}

if v, ok := m["enable_regex_in_path"].(bool); ok {
out.EnableRegexInPath = aws.Bool(v)
}
if v, ok := m["request_inspection"].([]interface{}); ok && len(v) > 0 {
out.RequestInspection = expandRequestInspection(v)
}
Expand Down Expand Up @@ -2322,7 +2325,8 @@ func flattenManagedRulesATPRuleSet(apiObject *wafv2.AWSManagedRulesATPRuleSet) [
}

m := map[string]interface{}{
"login_path": aws.StringValue(apiObject.LoginPath),
"enable_regex_in_path": aws.BoolValue(apiObject.EnableRegexInPath),
"login_path": aws.StringValue(apiObject.LoginPath),
}
if apiObject.RequestInspection != nil {
m["request_inspection"] = flattenRequestInspection(apiObject.RequestInspection)
Expand Down
32 changes: 18 additions & 14 deletions internal/service/wafv2/schemas.go
Original file line number Diff line number Diff line change
Expand Up @@ -999,26 +999,16 @@ func managedRuleGroupConfigSchema() *schema.Schema {
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"aws_managed_rules_bot_control_rule_set": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"inspection_level": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice(wafv2.InspectionLevel_Values(), false),
},
},
},
},
"aws_managed_rules_atp_rule_set": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"enable_regex_in_path": {
Type: schema.TypeBool,
Optional: true,
},
"login_path": {
Type: schema.TypeString,
Required: true,
Expand All @@ -1032,6 +1022,20 @@ func managedRuleGroupConfigSchema() *schema.Schema {
},
},
},
"aws_managed_rules_bot_control_rule_set": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"inspection_level": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice(wafv2.InspectionLevel_Values(), false),
},
},
},
},
"login_path": {
Type: schema.TypeString,
Optional: true,
Expand Down
Loading
Loading