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

d/aws_route53_resolver_rules: add new name_regex filter argument #24582

Conversation

Tailzip
Copy link
Contributor

@Tailzip Tailzip commented May 5, 2022

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

Add new name_regex filter argument for aws_route53_resolver_rules datasource. Given this isn't supported natively by AWS API, filtering is performed locally after retrieving results from the API.

Output from acceptance testing:

❯ make testacc TESTS=TestAccRoute53ResolverRulesDataSource PKG=route53resolver
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/route53resolver/... -v -count 1 -parallel 20 -run='TestAccRoute53ResolverRulesDataSource'  -timeout 180m
=== RUN   TestAccRoute53ResolverRulesDataSource_basic
=== PAUSE TestAccRoute53ResolverRulesDataSource_basic
=== RUN   TestAccRoute53ResolverRulesDataSource_resolverEndpointID
=== PAUSE TestAccRoute53ResolverRulesDataSource_resolverEndpointID
=== RUN   TestAccRoute53ResolverRulesDataSource_nameRegex
=== PAUSE TestAccRoute53ResolverRulesDataSource_nameRegex
=== RUN   TestAccRoute53ResolverRulesDataSource_nonExistentNameRegex
=== PAUSE TestAccRoute53ResolverRulesDataSource_nonExistentNameRegex
=== CONT  TestAccRoute53ResolverRulesDataSource_basic
=== CONT  TestAccRoute53ResolverRulesDataSource_nameRegex
=== CONT  TestAccRoute53ResolverRulesDataSource_resolverEndpointID
=== CONT  TestAccRoute53ResolverRulesDataSource_nonExistentNameRegex
--- PASS: TestAccRoute53ResolverRulesDataSource_basic (6.72s)
--- PASS: TestAccRoute53ResolverRulesDataSource_nonExistentNameRegex (7.97s)
--- PASS: TestAccRoute53ResolverRulesDataSource_nameRegex (29.14s)
--- PASS: TestAccRoute53ResolverRulesDataSource_resolverEndpointID (205.15s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/route53resolver    206.737s

...

@Tailzip Tailzip requested a review from ewbankkit as a code owner May 5, 2022 15:03
@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. documentation Introduces or discusses updates to documentation. service/route53resolver Issues and PRs that pertain to the route53resolver service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/M Managed by automation to categorize the size of a PR. labels May 5, 2022
@justinretzolk justinretzolk added enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels May 5, 2022
@Tailzip Tailzip force-pushed the d/aws_route53_resolver_rules/add_new_name_regex_filter_arg branch from e661c32 to 25348bf Compare May 6, 2022 10:06
@Tailzip
Copy link
Contributor Author

Tailzip commented May 6, 2022

Acceptance tests output after force-push:

❯ make testacc TESTS=TestAccRoute53ResolverRulesDataSource PKG=route53resolver
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/route53resolver/... -v -count 1 -parallel 20 -run='TestAccRoute53ResolverRulesDataSource'  -timeout 180m
=== RUN   TestAccRoute53ResolverRulesDataSource_basic
=== PAUSE TestAccRoute53ResolverRulesDataSource_basic
=== RUN   TestAccRoute53ResolverRulesDataSource_resolverEndpointID
=== PAUSE TestAccRoute53ResolverRulesDataSource_resolverEndpointID
=== RUN   TestAccRoute53ResolverRulesDataSource_nameRegex
=== PAUSE TestAccRoute53ResolverRulesDataSource_nameRegex
=== RUN   TestAccRoute53ResolverRulesDataSource_nonExistentNameRegex
=== PAUSE TestAccRoute53ResolverRulesDataSource_nonExistentNameRegex
=== CONT  TestAccRoute53ResolverRulesDataSource_basic
=== CONT  TestAccRoute53ResolverRulesDataSource_nameRegex
=== CONT  TestAccRoute53ResolverRulesDataSource_nonExistentNameRegex
=== CONT  TestAccRoute53ResolverRulesDataSource_resolverEndpointID
--- PASS: TestAccRoute53ResolverRulesDataSource_basic (7.74s)
--- PASS: TestAccRoute53ResolverRulesDataSource_nonExistentNameRegex (8.23s)
--- PASS: TestAccRoute53ResolverRulesDataSource_nameRegex (29.64s)
--- PASS: TestAccRoute53ResolverRulesDataSource_resolverEndpointID (205.48s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/route53resolver    207.060s

@drewmullen drewmullen self-requested a review May 6, 2022 15:27
Copy link
Collaborator

@drewmullen drewmullen left a comment

Choose a reason for hiding this comment

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

I believe you'd want to implement this feature as it behaves more natively with the api, by adding a filters block argument instead of individual arguments for each filter type. Here is an example of the implementation on another data source:

"filter": DataSourceFiltersSchema(),

@Tailzip
Copy link
Contributor Author

Tailzip commented May 7, 2022

I believe you'd want to implement this feature as it behaves more natively with the api, by adding a filters block argument instead of individual arguments for each filter type. Here is an example of the implementation on another data source.

Hi @drewmullen, which API are you referring to: provider's or Route53Resolver service's ? Name regex filtering isn't supported by Route53Resolver API.

@drewmullen
Copy link
Collaborator

drewmullen commented May 7, 2022

I believe you'd want to implement this feature as it behaves more natively with the api, by adding a filters block argument instead of individual arguments for each filter type. Here is an example of the implementation on another data source.

Hi @drewmullen, which API are you referring to: provider's or Route53Resolver service's ? Name regex filtering isn't supported by Route53Resolver API.

Oh jeesh. Ha - sorry about that! I just saw filters was supported and assumed. Let me take a closer look next week

@gdavison gdavison self-assigned this May 10, 2022
Copy link
Contributor

@gdavison gdavison left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, @Tailzip. It looks good, though I have a few suggestions for changes.

internal/service/route53resolver/rules_data_source_test.go Outdated Show resolved Hide resolved
internal/service/route53resolver/rules_data_source_test.go Outdated Show resolved Hide resolved
website/docs/d/route53_resolver_rules.html.markdown Outdated Show resolved Hide resolved
website/docs/d/route53_resolver_rules.html.markdown Outdated Show resolved Hide resolved
website/docs/d/route53_resolver_rules.html.markdown Outdated Show resolved Hide resolved
Tailzip and others added 2 commits May 11, 2022 20:44
Co-authored-by: Graham Davison <g.m.davison@computer.org>
@Tailzip
Copy link
Contributor Author

Tailzip commented May 11, 2022

Thanks for the review @gdavison, I've implemented the requested changes 😄

New acceptance tests output:

❯ make testacc TESTS=TestAccRoute53ResolverRulesDataSource PKG=route53resolver
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/route53resolver/... -v -count 1 -parallel 20 -run='TestAccRoute53ResolverRulesDataSource'  -timeout 180m
=== RUN   TestAccRoute53ResolverRulesDataSource_basic
=== PAUSE TestAccRoute53ResolverRulesDataSource_basic
=== RUN   TestAccRoute53ResolverRulesDataSource_resolverEndpointID
=== PAUSE TestAccRoute53ResolverRulesDataSource_resolverEndpointID
=== RUN   TestAccRoute53ResolverRulesDataSource_nameRegex
=== PAUSE TestAccRoute53ResolverRulesDataSource_nameRegex
=== RUN   TestAccRoute53ResolverRulesDataSource_nonExistentNameRegex
=== PAUSE TestAccRoute53ResolverRulesDataSource_nonExistentNameRegex
=== CONT  TestAccRoute53ResolverRulesDataSource_basic
=== CONT  TestAccRoute53ResolverRulesDataSource_nameRegex
=== CONT  TestAccRoute53ResolverRulesDataSource_resolverEndpointID
=== CONT  TestAccRoute53ResolverRulesDataSource_nonExistentNameRegex
--- PASS: TestAccRoute53ResolverRulesDataSource_nonExistentNameRegex (8.42s)
--- PASS: TestAccRoute53ResolverRulesDataSource_basic (8.44s)
--- PASS: TestAccRoute53ResolverRulesDataSource_nameRegex (30.37s)
--- PASS: TestAccRoute53ResolverRulesDataSource_resolverEndpointID (216.33s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/route53resolver    217.901s

@Tailzip Tailzip requested a review from gdavison May 11, 2022 19:01
Copy link
Contributor

@gdavison gdavison left a comment

Choose a reason for hiding this comment

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

Thanks, @Tailzip. Looks good! 🚀

--- PASS: TestAccRoute53ResolverRulesDataSource_basic (26.38s)
--- PASS: TestAccRoute53ResolverRulesDataSource_nonExistentNameRegex (26.69s)
--- PASS: TestAccRoute53ResolverRulesDataSource_nameRegex (49.83s)
--- PASS: TestAccRoute53ResolverRulesDataSource_resolverEndpointID (265.65s)

@gdavison gdavison merged commit c47df10 into hashicorp:main May 18, 2022
@github-actions github-actions bot added this to the v4.15.0 milestone May 18, 2022
@github-actions
Copy link

This functionality has been released in v4.15.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!

@github-actions
Copy link

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. service/route53resolver Issues and PRs that pertain to the route53resolver service. size/M 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.

4 participants