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

gosimple: Fix WAF-related issues #6402

Merged
merged 1 commit into from
Nov 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aws/resource_aws_waf_byte_match_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func updateByteMatchSetResource(id string, oldT, newT []interface{}, conn *waf.W
}

func flattenWafByteMatchTuples(bmt []*waf.ByteMatchTuple) []interface{} {
out := make([]interface{}, len(bmt), len(bmt))
out := make([]interface{}, len(bmt))
for i, t := range bmt {
m := make(map[string]interface{})

Expand Down
5 changes: 1 addition & 4 deletions aws/resource_aws_waf_rule_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,8 @@ func resourceAwsWafRuleGroupDelete(d *schema.ResourceData, meta interface{}) err

oldRules := d.Get("activated_rule").(*schema.Set).List()
err := deleteWafRuleGroup(d.Id(), oldRules, conn)
if err != nil {
return err
}

return nil
return err
}

func deleteWafRuleGroup(id string, oldRules []interface{}, conn *waf.WAF) error {
Expand Down
6 changes: 2 additions & 4 deletions aws/resource_aws_waf_size_constraint_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,8 @@ func testAccCheckAWSWafSizeConstraintSetDisappears(v *waf.SizeConstraintSet) res
}
return conn.DeleteSizeConstraintSet(opts)
})
if err != nil {
return err
}
return nil

return err
}
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_waf_sql_injection_match_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func updateSqlInjectionMatchSetResource(id string, oldT, newT []interface{}, con
}

func flattenWafSqlInjectionMatchTuples(ts []*waf.SqlInjectionMatchTuple) []interface{} {
out := make([]interface{}, len(ts), len(ts))
out := make([]interface{}, len(ts))
for i, t := range ts {
m := make(map[string]interface{})
m["text_transformation"] = *t.TextTransformation
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_waf_xss_match_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func updateXssMatchSetResource(id string, oldT, newT []interface{}, conn *waf.WA
}

func flattenWafXssMatchTuples(ts []*waf.XssMatchTuple) []interface{} {
out := make([]interface{}, len(ts), len(ts))
out := make([]interface{}, len(ts))
for i, t := range ts {
m := make(map[string]interface{})
m["field_to_match"] = flattenFieldToMatch(t.FieldToMatch)
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_wafregional_ipset.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func resourceAwsWafRegionalIPSetRead(d *schema.ResourceData, meta interface{}) e
}

func flattenWafIpSetDescriptorWR(in []*waf.IPSetDescriptor) []interface{} {
descriptors := make([]interface{}, len(in), len(in))
descriptors := make([]interface{}, len(in))

for i, descriptor := range in {
d := map[string]interface{}{
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_wafregional_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func updateWafRegionalRuleResource(id string, oldP, newP []interface{}, meta int
}

func flattenWafPredicates(ts []*waf.Predicate) []interface{} {
out := make([]interface{}, len(ts), len(ts))
out := make([]interface{}, len(ts))
for i, p := range ts {
m := make(map[string]interface{})
m["negated"] = *p.Negated
Expand Down
5 changes: 1 addition & 4 deletions aws/resource_aws_wafregional_rule_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,8 @@ func resourceAwsWafRegionalRuleGroupDelete(d *schema.ResourceData, meta interfac

oldRules := d.Get("activated_rule").(*schema.Set).List()
err := deleteWafRegionalRuleGroup(d.Id(), oldRules, conn, region)
if err != nil {
return err
}

return nil
return err
}

func deleteWafRegionalRuleGroup(id string, oldRules []interface{}, conn *wafregional.WAFRegional, region string) error {
Expand Down
6 changes: 2 additions & 4 deletions aws/resource_aws_wafregional_size_constraint_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,8 @@ func testAccCheckAWSWafRegionalSizeConstraintSetDisappears(constraints *waf.Size
}
return conn.DeleteSizeConstraintSet(opts)
})
if err != nil {
return err
}
return nil

return err
}
}

Expand Down
6 changes: 1 addition & 5 deletions aws/resource_aws_wafregional_web_acl_association.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,7 @@ func resourceAwsWafRegionalWebAclAssociationDelete(d *schema.ResourceData, meta

// If action successful HTTP 200 response with an empty body
_, err := conn.DisassociateWebACL(params)
if err != nil {
return err
}

return nil
return err
}

func resourceAwsWafRegionalWebAclAssociationParseId(id string) (webAclId, resourceArn string) {
Expand Down
8 changes: 4 additions & 4 deletions aws/waf_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func diffWafSizeConstraints(oldS, newS []interface{}) []*waf.SizeConstraintSetUp
}

func flattenWafSizeConstraints(sc []*waf.SizeConstraint) []interface{} {
out := make([]interface{}, len(sc), len(sc))
out := make([]interface{}, len(sc))
for i, c := range sc {
m := make(map[string]interface{})
m["comparison_operator"] = *c.ComparisonOperator
Expand All @@ -113,7 +113,7 @@ func flattenWafSizeConstraints(sc []*waf.SizeConstraint) []interface{} {
}

func flattenWafGeoMatchConstraint(ts []*waf.GeoMatchConstraint) []interface{} {
out := make([]interface{}, len(ts), len(ts))
out := make([]interface{}, len(ts))
for i, t := range ts {
m := make(map[string]interface{})
m["type"] = *t.Type
Expand Down Expand Up @@ -256,7 +256,7 @@ func diffWafRuleGroupActivatedRules(oldRules, newRules []interface{}) []*waf.Rul
}

func flattenWafActivatedRules(activatedRules []*waf.ActivatedRule) []interface{} {
out := make([]interface{}, len(activatedRules), len(activatedRules))
out := make([]interface{}, len(activatedRules))
for i, ar := range activatedRules {
rule := map[string]interface{}{
"priority": int(*ar.Priority),
Expand Down Expand Up @@ -292,7 +292,7 @@ func expandWafActivatedRule(rule map[string]interface{}) *waf.ActivatedRule {
}

func flattenWafRegexMatchTuples(tuples []*waf.RegexMatchTuple) []interface{} {
out := make([]interface{}, len(tuples), len(tuples))
out := make([]interface{}, len(tuples))
for i, t := range tuples {
m := make(map[string]interface{})

Expand Down