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

Added pagination support to DescribeFileSystems in EFS #33336

Merged
merged 3 commits into from
Sep 8, 2023

Conversation

kuredev
Copy link
Contributor

@kuredev kuredev commented Sep 6, 2023

Description

When an AWS account has more than 101 EFS resources, If you specify the data source of aws_efs_file_system with a tag, pagination does not work and the resource cannot be found.
This PR changes the DescribeFileSystems used at that time to use pagination.

Steps to Reproduce

  • Create 101+ EFS
    • Tag the oldest resource.
  • Create a data source with the oldest resource's tag.
data "aws_efs_file_system" "foo" {
  tags = {
    test = "test"
  }
}
  • terraform apply

Before

data.aws_efs_file_system.foo: Reading...
╷
│ Error: Search returned 0 results, please revise so only one is returned
│ 
│   with data.aws_efs_file_system.foo,
│   on main.tf line 14, in data "aws_efs_file_system" "foo":
│   14: data "aws_efs_file_system" "foo" {

After

data.aws_efs_file_system.foo: Reading...
data.aws_efs_file_system.foo: Read complete after 2s [id=fs-xxxxxxx]

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Relations

Closes #26863

References

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/efs_file_system
https://docs.aws.amazon.com/sdk-for-go/api/service/efs/#EFS.DescribeFileSystemsPagesWithContext

Output from Acceptance Testing

 % make testacc TESTS=TestAccEFSFileSystemDataSource_tags PKG=efs                                   (git)-[add-support-efs-describe-fs-pagination] 
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/efs/... -v -count 1 -parallel 20 -run='TestAccEFSFileSystemDataSource_tags'  -timeout 180m
=== RUN   TestAccEFSFileSystemDataSource_tags
=== PAUSE TestAccEFSFileSystemDataSource_tags
=== CONT  TestAccEFSFileSystemDataSource_tags
--- PASS: TestAccEFSFileSystemDataSource_tags (34.87s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/efs   

...

@github-actions
Copy link

github-actions bot commented Sep 6, 2023

Community Note

Voting for Prioritization

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

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added size/XS Managed by automation to categorize the size of a PR. service/efs Issues and PRs that pertain to the efs service. labels Sep 6, 2023
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Sep 6, 2023
@kuredev kuredev marked this pull request as ready for review September 7, 2023 15:31
@ewbankkit ewbankkit added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Sep 7, 2023
Copy link
Contributor

@ewbankkit ewbankkit left a 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=TestAccEFSFileSystemDataSource_\|TestAccEFSFileSystem_' PKG=efs ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/efs/... -v -count 1 -parallel 3  -run=TestAccEFSFileSystemDataSource_\|TestAccEFSFileSystem_ -timeout 180m
=== RUN   TestAccEFSFileSystemDataSource_id
=== PAUSE TestAccEFSFileSystemDataSource_id
=== RUN   TestAccEFSFileSystemDataSource_tags
=== PAUSE TestAccEFSFileSystemDataSource_tags
=== RUN   TestAccEFSFileSystemDataSource_name
=== PAUSE TestAccEFSFileSystemDataSource_name
=== RUN   TestAccEFSFileSystemDataSource_availabilityZone
=== PAUSE TestAccEFSFileSystemDataSource_availabilityZone
=== RUN   TestAccEFSFileSystemDataSource_nonExistent_tags
=== PAUSE TestAccEFSFileSystemDataSource_nonExistent_tags
=== RUN   TestAccEFSFileSystem_basic
=== PAUSE TestAccEFSFileSystem_basic
=== RUN   TestAccEFSFileSystem_disappears
=== PAUSE TestAccEFSFileSystem_disappears
=== RUN   TestAccEFSFileSystem_performanceMode
=== PAUSE TestAccEFSFileSystem_performanceMode
=== RUN   TestAccEFSFileSystem_availabilityZoneName
=== PAUSE TestAccEFSFileSystem_availabilityZoneName
=== RUN   TestAccEFSFileSystem_tags
=== PAUSE TestAccEFSFileSystem_tags
=== RUN   TestAccEFSFileSystem_kmsKey
=== PAUSE TestAccEFSFileSystem_kmsKey
=== RUN   TestAccEFSFileSystem_kmsWithoutEncryption
=== PAUSE TestAccEFSFileSystem_kmsWithoutEncryption
=== RUN   TestAccEFSFileSystem_provisionedThroughputInMibps
=== PAUSE TestAccEFSFileSystem_provisionedThroughputInMibps
=== RUN   TestAccEFSFileSystem_throughputMode
=== PAUSE TestAccEFSFileSystem_throughputMode
=== RUN   TestAccEFSFileSystem_lifecyclePolicy
=== PAUSE TestAccEFSFileSystem_lifecyclePolicy
=== CONT  TestAccEFSFileSystemDataSource_id
=== CONT  TestAccEFSFileSystem_availabilityZoneName
=== CONT  TestAccEFSFileSystemDataSource_nonExistent_tags
--- PASS: TestAccEFSFileSystemDataSource_id (34.59s)
=== CONT  TestAccEFSFileSystemDataSource_name
--- PASS: TestAccEFSFileSystemDataSource_nonExistent_tags (36.06s)
=== CONT  TestAccEFSFileSystemDataSource_availabilityZone
--- PASS: TestAccEFSFileSystem_availabilityZoneName (39.16s)
=== CONT  TestAccEFSFileSystem_provisionedThroughputInMibps
--- PASS: TestAccEFSFileSystemDataSource_name (29.47s)
=== CONT  TestAccEFSFileSystem_lifecyclePolicy
--- PASS: TestAccEFSFileSystemDataSource_availabilityZone (32.04s)
=== CONT  TestAccEFSFileSystem_throughputMode
--- PASS: TestAccEFSFileSystem_provisionedThroughputInMibps (50.76s)
=== CONT  TestAccEFSFileSystem_kmsKey
--- PASS: TestAccEFSFileSystem_throughputMode (52.34s)
=== CONT  TestAccEFSFileSystem_kmsWithoutEncryption
--- PASS: TestAccEFSFileSystem_kmsKey (34.40s)
=== CONT  TestAccEFSFileSystemDataSource_tags
--- PASS: TestAccEFSFileSystem_kmsWithoutEncryption (12.23s)
=== CONT  TestAccEFSFileSystem_disappears
--- PASS: TestAccEFSFileSystem_lifecyclePolicy (84.74s)
=== CONT  TestAccEFSFileSystem_performanceMode
--- PASS: TestAccEFSFileSystemDataSource_tags (29.72s)
=== CONT  TestAccEFSFileSystem_tags
--- PASS: TestAccEFSFileSystem_disappears (25.79s)
=== CONT  TestAccEFSFileSystem_basic
--- PASS: TestAccEFSFileSystem_performanceMode (28.69s)
--- PASS: TestAccEFSFileSystem_basic (31.07s)
--- PASS: TestAccEFSFileSystem_tags (92.39s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/efs	251.677s

@ewbankkit
Copy link
Contributor

@kuredev Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit 715dc15 into hashicorp:main Sep 8, 2023
34 checks passed
@github-actions github-actions bot added this to the v5.17.0 milestone Sep 8, 2023
@ewbankkit ewbankkit modified the milestones: v5.17.0, v5.16.1 Sep 8, 2023
@github-actions
Copy link

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

@kuredev kuredev deleted the b-support-pagination-describe-efs branch September 13, 2023 03:06
@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 Oct 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/efs Issues and PRs that pertain to the efs service. size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: The efs_file_system data source resource does not follow pagination
2 participants