Skip to content

Commit

Permalink
Merge pull request #33217 from rasekoli/f-wafv2-atp-regex-support
Browse files Browse the repository at this point in the history
Added ATP enable_regex_in_path parameter for login path
  • Loading branch information
ewbankkit authored Aug 30, 2023
2 parents b855901 + 9ec7c59 commit d72d848
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 155 deletions.
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

0 comments on commit d72d848

Please sign in to comment.