Skip to content

Commit

Permalink
Merge pull request #13674 from terraform-providers/ap_unparam_linting…
Browse files Browse the repository at this point in the history
…_waf

resource/waf: remove unused params in methods
  • Loading branch information
anGie44 authored Jun 12, 2020
2 parents a1022e4 + 176a1ab commit 1f0f6dc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
7 changes: 3 additions & 4 deletions aws/resource_aws_wafregional_web_acl_association.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func resourceAwsWafRegionalWebAclAssociationCreate(d *schema.ResourceData, meta
func resourceAwsWafRegionalWebAclAssociationRead(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).wafregionalconn

_, resourceArn := resourceAwsWafRegionalWebAclAssociationParseId(d.Id())
resourceArn := resourceAwsWafRegionalWebAclAssociationParseId(d.Id())

input := &wafregional.GetWebACLForResourceInput{
ResourceArn: aws.String(resourceArn),
Expand Down Expand Up @@ -111,7 +111,7 @@ func resourceAwsWafRegionalWebAclAssociationRead(d *schema.ResourceData, meta in
func resourceAwsWafRegionalWebAclAssociationDelete(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).wafregionalconn

_, resourceArn := resourceAwsWafRegionalWebAclAssociationParseId(d.Id())
resourceArn := resourceAwsWafRegionalWebAclAssociationParseId(d.Id())

log.Printf("[INFO] Deleting WAF Regional Web ACL association: %s", resourceArn)

Expand All @@ -124,9 +124,8 @@ func resourceAwsWafRegionalWebAclAssociationDelete(d *schema.ResourceData, meta
return err
}

func resourceAwsWafRegionalWebAclAssociationParseId(id string) (webAclId, resourceArn string) {
func resourceAwsWafRegionalWebAclAssociationParseId(id string) (resourceArn string) {
parts := strings.SplitN(id, ":", 2)
webAclId = parts[0]
resourceArn = parts[1]
return
}
6 changes: 3 additions & 3 deletions aws/resource_aws_wafregional_web_acl_association_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func testAccCheckWafRegionalWebAclAssociationDestroy(s *terraform.State) error {
continue
}

_, resourceArn := resourceAwsWafRegionalWebAclAssociationParseId(rs.Primary.ID)
resourceArn := resourceAwsWafRegionalWebAclAssociationParseId(rs.Primary.ID)

input := &wafregional.GetWebACLForResourceInput{
ResourceArn: aws.String(resourceArn),
Expand Down Expand Up @@ -142,7 +142,7 @@ func testAccCheckWafRegionalWebAclAssociationExists(n string) resource.TestCheck
return fmt.Errorf("No WebACL association ID is set")
}

_, resourceArn := resourceAwsWafRegionalWebAclAssociationParseId(rs.Primary.ID)
resourceArn := resourceAwsWafRegionalWebAclAssociationParseId(rs.Primary.ID)

conn := testAccProvider.Meta().(*AWSClient).wafregionalconn

Expand All @@ -169,7 +169,7 @@ func testAccCheckWafRegionalWebAclAssociationDisappears(resourceName string) res
return fmt.Errorf("No WebACL association ID is set")
}

_, resourceArn := resourceAwsWafRegionalWebAclAssociationParseId(rs.Primary.ID)
resourceArn := resourceAwsWafRegionalWebAclAssociationParseId(rs.Primary.ID)

conn := testAccProvider.Meta().(*AWSClient).wafregionalconn

Expand Down
6 changes: 3 additions & 3 deletions aws/resource_aws_wafv2_rule_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ func TestAccAwsWafv2RuleGroup_IpSetReferenceStatement(t *testing.T) {
computeWafv2IpSetRefStatementIndex(&v, &idx),
testCheckResourceAttrWithIndexesAddr(resourceName, "rule.%d.statement.#", &idx, "1"),
testCheckResourceAttrWithIndexesAddr(resourceName, "rule.%d.statement.0.ip_set_reference_statement.#", &idx, "1"),
testAccMatchResourceAttrArnWithIndexesAddr(resourceName, "rule.%d.statement.0.ip_set_reference_statement.0.arn", &idx, "wafv2", regexp.MustCompile(`regional/ipset/.+$`)),
testAccMatchResourceAttrArnWithIndexesAddr(resourceName, "rule.%d.statement.0.ip_set_reference_statement.0.arn", &idx, regexp.MustCompile(`regional/ipset/.+$`)),
),
},
{
Expand Down Expand Up @@ -649,7 +649,7 @@ func TestAccAwsWafv2RuleGroup_RegexPatternSetReferenceStatement(t *testing.T) {
testCheckResourceAttrWithIndexesAddr(resourceName, "rule.%d.statement.0.regex_pattern_set_reference_statement.#", &idx, "1"),
testCheckResourceAttrWithIndexesAddr(resourceName, "rule.%d.statement.0.regex_pattern_set_reference_statement.0.field_to_match.#", &idx, "1"),
testCheckResourceAttrWithIndexesAddr(resourceName, "rule.%d.statement.0.regex_pattern_set_reference_statement.0.text_transformation.#", &idx, "1"),
testAccMatchResourceAttrArnWithIndexesAddr(resourceName, "rule.%d.statement.0.regex_pattern_set_reference_statement.0.arn", &idx, "wafv2", regexp.MustCompile(`regional/regexpatternset/.+$`)),
testAccMatchResourceAttrArnWithIndexesAddr(resourceName, "rule.%d.statement.0.regex_pattern_set_reference_statement.0.arn", &idx, regexp.MustCompile(`regional/regexpatternset/.+$`)),
),
},
{
Expand Down Expand Up @@ -937,7 +937,7 @@ func TestAccAwsWafv2RuleGroup_XssMatchStatement(t *testing.T) {
})
}

func testAccMatchResourceAttrArnWithIndexesAddr(name, format string, idx *int, arnService string, arnResourceRegexp *regexp.Regexp) resource.TestCheckFunc {
func testAccMatchResourceAttrArnWithIndexesAddr(name, format string, idx *int, arnResourceRegexp *regexp.Regexp) resource.TestCheckFunc {
return func(s *terraform.State) error {
return testAccMatchResourceAttrRegionalARN(name, fmt.Sprintf(format, *idx), "wafv2", arnResourceRegexp)(s)
}
Expand Down

0 comments on commit 1f0f6dc

Please sign in to comment.