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

r/aws_route53_resolver_firewall_rule_group: Fix prefer-pagination-bool-var-last-page semgrep error #18886

Merged

Conversation

ewbankkit
Copy link
Contributor

@ewbankkit ewbankkit commented Apr 15, 2021

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Relates: #18554.
Relates: #18651.

Fixes current main semgrep error:

prefer-pagination-bool-var-last-page
     > aws/resource_aws_route53_resolver_firewall_rule_group_test.go:35
     ╷
=== exiting with failing status
   35│   err = conn.ListFirewallRuleGroupsPages(&route53resolver.ListFirewallRuleGroupsInput{}, func(page *route53resolver.ListFirewallRuleGroupsOutput, isLast bool) bool {
   36│   	if page == nil {
   37│   		return !isLast
   38│   	}
   39│   
   40│   	for _, firewallRuleGroup := range page.FirewallRuleGroups {
   41│   		id := aws.StringValue(firewallRuleGroup.Id)
   42│   
   43│   		log.Printf("[INFO] Deleting Route53 Resolver DNS Firewall rule group: %s", id)
   44│   		r := resourceAwsRoute53ResolverFirewallRuleGroup()
   45│   		d := r.Data(nil)
   46│   		d.SetId(id)
   47│   		err := r.Delete(d, client)
   48│   
   49│   		if err != nil {
Error:   			log.Printf("[ERROR] %s", err)
   51│   			sweeperErrs = multierror.Append(sweeperErrs, err)
   52│   			continue
   53│   		}
   54│   	}
   55│   
   56│   	return !isLast
   57│   })
     ╵
     = Use lastPage for bool variable in pagination functions

Output from acceptance testing:

n/a

@ewbankkit ewbankkit requested a review from a team as a code owner April 15, 2021 14:30
@ghost ghost added size/XS Managed by automation to categorize the size of a PR. service/route53resolver Issues and PRs that pertain to the route53resolver service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Apr 15, 2021
Copy link
Contributor

@anGie44 anGie44 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@ewbankkit ewbankkit merged commit 8f720fe into main Apr 15, 2021
@ewbankkit ewbankkit deleted the td-fix-aws_route53_resolver_firewall_rule_group-semgrep-error branch April 15, 2021 14:53
@github-actions github-actions bot added this to the v3.37.0 milestone Apr 15, 2021
github-actions bot pushed a commit that referenced this pull request Apr 15, 2021
@ghost
Copy link

ghost commented Apr 16, 2021

This has been released in version 3.37.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented May 15, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators May 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/route53resolver Issues and PRs that pertain to the route53resolver service. size/XS Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants