Skip to content

Commit

Permalink
update root rule schema called at update time; refactor shared schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
anGie44 committed Jul 10, 2020
1 parent 06f8b94 commit d68d05c
Show file tree
Hide file tree
Showing 5 changed files with 477 additions and 499 deletions.
33 changes: 1 addition & 32 deletions aws/resource_aws_wafv2_rule_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,38 +75,7 @@ func resourceAwsWafv2RuleGroup() *schema.Resource {
wafv2.ScopeRegional,
}, false),
},
"rule": {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"action": {
Type: schema.TypeList,
Required: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"allow": wafv2EmptySchema(),
"block": wafv2EmptySchema(),
"count": wafv2EmptySchema(),
},
},
},
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringLenBetween(1, 128),
},
"priority": {
Type: schema.TypeInt,
Required: true,
},
"statement": wafv2RootStatementSchema(3),
"visibility_config": wafv2VisibilityConfigSchema(),
},
},
},
"rule": wafv2RuleSchema(),
"tags": tagsSchema(),
"visibility_config": wafv2VisibilityConfigSchema(),
},
Expand Down
26 changes: 17 additions & 9 deletions aws/resource_aws_wafv2_rule_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,7 @@ func computeWafv2IpSetRefStatementIndex(r *wafv2.RuleGroup, idx *int) resource.T
"count": []interface{}{},
},
},
"override_action": []interface{}{},
"statement": []interface{}{
map[string]interface{}{
"and_statement": []interface{}{},
Expand All @@ -1047,9 +1048,12 @@ func computeWafv2IpSetRefStatementIndex(r *wafv2.RuleGroup, idx *int) resource.T
"arn": aws.StringValue(r.Rules[0].Statement.IPSetReferenceStatement.ARN),
},
},
"managed_rule_group_statement": []interface{}{},
"not_statement": []interface{}{},
"or_statement": []interface{}{},
"rate_based_statement": []interface{}{},
"regex_pattern_set_reference_statement": []interface{}{},
"rule_group_reference_statement": []interface{}{},
"size_constraint_statement": []interface{}{},
"sqli_match_statement": []interface{}{},
"xss_match_statement": []interface{}{},
Expand Down Expand Up @@ -1086,14 +1090,17 @@ func computeWafv2RegexSetRefStatementIndex(r *wafv2.RuleGroup, idx *int) resourc
"count": []interface{}{},
},
},
"override_action": []interface{}{},
"statement": []interface{}{
map[string]interface{}{
"and_statement": []interface{}{},
"byte_match_statement": []interface{}{},
"geo_match_statement": []interface{}{},
"ip_set_reference_statement": []interface{}{},
"not_statement": []interface{}{},
"or_statement": []interface{}{},
"and_statement": []interface{}{},
"byte_match_statement": []interface{}{},
"geo_match_statement": []interface{}{},
"ip_set_reference_statement": []interface{}{},
"managed_rule_group_statement": []interface{}{},
"not_statement": []interface{}{},
"or_statement": []interface{}{},
"rate_based_statement": []interface{}{},
"regex_pattern_set_reference_statement": []interface{}{
map[string]interface{}{
"arn": aws.StringValue(r.Rules[0].Statement.RegexPatternSetReferenceStatement.ARN),
Expand All @@ -1116,9 +1123,10 @@ func computeWafv2RegexSetRefStatementIndex(r *wafv2.RuleGroup, idx *int) resourc
}),
},
},
"size_constraint_statement": []interface{}{},
"sqli_match_statement": []interface{}{},
"xss_match_statement": []interface{}{},
"rule_group_reference_statement": []interface{}{},
"size_constraint_statement": []interface{}{},
"sqli_match_statement": []interface{}{},
"xss_match_statement": []interface{}{},
},
},
"visibility_config": []interface{}{
Expand Down
Loading

0 comments on commit d68d05c

Please sign in to comment.