Skip to content

Commit

Permalink
tests/resource/aws_wafregional_web_acl: Add rule type to computeWafRe…
Browse files Browse the repository at this point in the history
…gionalWebAclRuleIndex
  • Loading branch information
bflad committed Jun 25, 2018
1 parent b84661a commit e6e0e62
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions aws/resource_aws_wafregional_web_acl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func TestAccAWSWafRegionalWebAcl_changeRules(t *testing.T) {
"aws_wafregional_web_acl.waf_acl", "name", wafAclName),
resource.TestCheckResourceAttr(
"aws_wafregional_web_acl.waf_acl", "rule.#", "1"),
computeWafRegionalWebAclRuleIndex(&r.RuleId, 1, "BLOCK", &idx),
computeWafRegionalWebAclRuleIndex(&r.RuleId, 1, "REGULAR", "BLOCK", &idx),
testCheckResourceAttrWithIndexesAddr("aws_wafregional_web_acl.waf_acl", "rule.%d.priority", &idx, "1"),
),
},
Expand All @@ -259,14 +259,15 @@ func TestAccAWSWafRegionalWebAcl_changeRules(t *testing.T) {
}

// Calculates the index which isn't static because ruleId is generated as part of the test
func computeWafRegionalWebAclRuleIndex(ruleId **string, priority int, actionType string, idx *int) resource.TestCheckFunc {
func computeWafRegionalWebAclRuleIndex(ruleId **string, priority int, ruleType string, actionType string, idx *int) resource.TestCheckFunc {
return func(s *terraform.State) error {
ruleResource := resourceAwsWafRegionalWebAcl().Schema["rule"].Elem.(*schema.Resource)
actionMap := map[string]interface{}{
"type": actionType,
}
m := map[string]interface{}{
"rule_id": **ruleId,
"type": ruleType,
"priority": priority,
"action": []interface{}{actionMap},
}
Expand Down

0 comments on commit e6e0e62

Please sign in to comment.