-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Add pagination to aws_route53_resolver_rule data source #20642
Add pagination to aws_route53_resolver_rule data source #20642
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welcome @sheacloud 👋
It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTING guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.
Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.
Thanks again, and welcome to the community! 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀.
% make testacc TESTARGS='-run=TestAccAWSRoute53ResolverRuleDataSource_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSRoute53ResolverRuleDataSource_ -timeout 180m
=== RUN TestAccAWSRoute53ResolverRuleDataSource_basic
=== PAUSE TestAccAWSRoute53ResolverRuleDataSource_basic
=== RUN TestAccAWSRoute53ResolverRuleDataSource_ResolverEndpointIdWithTags
=== PAUSE TestAccAWSRoute53ResolverRuleDataSource_ResolverEndpointIdWithTags
=== RUN TestAccAWSRoute53ResolverRuleDataSource_SharedByMe
=== PAUSE TestAccAWSRoute53ResolverRuleDataSource_SharedByMe
=== RUN TestAccAWSRoute53ResolverRuleDataSource_SharedWithMe
=== PAUSE TestAccAWSRoute53ResolverRuleDataSource_SharedWithMe
=== CONT TestAccAWSRoute53ResolverRuleDataSource_basic
=== CONT TestAccAWSRoute53ResolverRuleDataSource_SharedWithMe
=== CONT TestAccAWSRoute53ResolverRuleDataSource_SharedByMe
=== CONT TestAccAWSRoute53ResolverRuleDataSource_ResolverEndpointIdWithTags
=== CONT TestAccAWSRoute53ResolverRuleDataSource_SharedByMe
provider_test.go:715: skipping test because at least one environment variable of [AWS_ALTERNATE_PROFILE AWS_ALTERNATE_ACCESS_KEY_ID] must be set. Usage: credentials for running acceptance testing in alternate AWS account.
=== CONT TestAccAWSRoute53ResolverRuleDataSource_SharedWithMe
provider_test.go:715: skipping test because at least one environment variable of [AWS_ALTERNATE_PROFILE AWS_ALTERNATE_ACCESS_KEY_ID] must be set. Usage: credentials for running acceptance testing in alternate AWS account.
--- SKIP: TestAccAWSRoute53ResolverRuleDataSource_SharedByMe (0.81s)
--- SKIP: TestAccAWSRoute53ResolverRuleDataSource_SharedWithMe (0.82s)
--- PASS: TestAccAWSRoute53ResolverRuleDataSource_basic (38.68s)
--- PASS: TestAccAWSRoute53ResolverRuleDataSource_ResolverEndpointIdWithTags (267.64s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 274.453s
@sheacloud Thanks for the contribution 🎉 👏. |
This functionality has been released in v3.56.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. Thank you! |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
What
Updated the aws_route53_resolver_rule data source to use pagination when looking for matching rules. Currently it only calls ListResolverRules once, and if there are no returned results, it assumes there is no matching rule, even if there is a NextToken returned alongside it.
Why
Recently the route53 API behavior changed when calling ListResolverRules in an account with a large number of rules (100s+) where it sometimes returns 0 results but a pagination NextToken. After discussing this with AWS support, it was concluded that it is expected, valid behavior. The same behavior can be seen with other APIs such as dynamodb or cloudwatch logs when filtering a large number of resources.
Reproducing
The following terraform can be used to create an example environment which can then be used to reproduce the error
The following template attempts to pull some of the rules as data sources, resulting in "no matching rules" errors
You can also validate this using the AWS CLI with the 1st template deployed by running
a few times, and eventually you should get a result like
Output from acceptance testing:
I'm having issues running the Shared* tests which interact with RAM in my accounts. I have RAM sharing at the org level enabled, so I'm not sure what is wrong, but I get the same errors when I run the tests against the code prior to my changes (i.e. checked out on the commit before my changes)