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

Data source aws_secretsmanager_secret_versions #35411

Merged
merged 20 commits into from
Aug 8, 2024

Conversation

wcmjunior
Copy link
Contributor

@wcmjunior wcmjunior commented Jan 20, 2024

Description

Add a new data source aws_secretsmanager_secret_versions to retrieve the secret versions from a secret.

Relations

Closes #29469

Output from Acceptance Testing

% make testacc TESTS=TestAccSecretsManagerSecretVersionsDataSource_basic PKG=secretsmanager 
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/secretsmanager/... -v -count 1 -parallel 20 -run='TestAccSecretsManagerSecretVersionsDataSource_basic'  -timeout 360m
=== RUN   TestAccSecretsManagerSecretVersionsDataSource_basic
=== PAUSE TestAccSecretsManagerSecretVersionsDataSource_basic
=== CONT  TestAccSecretsManagerSecretVersionsDataSource_basic
--- PASS: TestAccSecretsManagerSecretVersionsDataSource_basic (14.68s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/secretsmanager     20.550s

% make testacc TESTS=TestAccSecretsManagerSecretVersionsDataSource_maxResults PKG=secretsmanager
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/secretsmanager/... -v -count 1 -parallel 20 -run='TestAccSecretsManagerSecretVersionsDataSource_maxResults'  -timeout 360m
=== RUN   TestAccSecretsManagerSecretVersionsDataSource_maxResults
=== PAUSE TestAccSecretsManagerSecretVersionsDataSource_maxResults
=== CONT  TestAccSecretsManagerSecretVersionsDataSource_maxResults
--- PASS: TestAccSecretsManagerSecretVersionsDataSource_maxResults (7.35s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/secretsmanager     13.146s
...

Copy link

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 the size/L Managed by automation to categorize the size of a PR. label Jan 20, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Jan 20, 2024
@github-actions github-actions bot added documentation Introduces or discusses updates to documentation. service/secretsmanager Issues and PRs that pertain to the secretsmanager service. generators Relates to code generators. labels Jan 20, 2024
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome @wcmjunior 👋

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 CONTRIBUTOR 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! 😃

@justinretzolk justinretzolk added new-data-source Introduces a new data source. and removed needs-triage Waiting for first response or review from a maintainer. labels Jan 22, 2024
Copy link

Thank you for your contribution! 🚀

Please note that typically Go dependency changes are handled in this repository by dependabot or the maintainers. This is to prevent pull request merge conflicts and further delay reviews of contributions. Remove any changes to the go.mod or go.sum files and commit them into this pull request.

Additional details:

  • Check open pull requests with the dependencies label to view other dependency updates.
  • If this pull request includes an update the AWS Go SDK (or any other dependency) version, only updates submitted via dependabot will be merged. This pull request will need to remove these changes and will need to be rebased after the existing dependency update via dependabot has been merged for this pull request to be reviewed.
  • If this pull request is for supporting a new AWS service:
    • Ensure the new AWS service changes are following the Contributing Guide section on new services, in particular that the dependency addition and initial provider support are in a separate pull request from other changes (e.g. new resources). Contributions not following this item will not be reviewed until the changes are split.
    • If this pull request is already a separate pull request from the above item, you can ignore this message.

@wcmjunior wcmjunior force-pushed the f-aws_secretsmanager_secret_versions branch 2 times, most recently from dd476a3 to 1db44ea Compare January 25, 2024 09:05
@wcmjunior wcmjunior force-pushed the f-aws_secretsmanager_secret_versions branch from 84209d6 to ee25781 Compare January 25, 2024 18:19
@wcmjunior wcmjunior changed the title [WIP] Data source aws_secretsmanager_secret_versions Data source aws_secretsmanager_secret_versions Jan 25, 2024
@wcmjunior wcmjunior marked this pull request as ready for review January 25, 2024 19:16
@github-actions github-actions bot added size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. and removed size/L Managed by automation to categorize the size of a PR. labels Jan 25, 2024
@wcmjunior
Copy link
Contributor Author

Hey @justinretzolk . Do you know when you (or someone else) will be available to review this PR? This is just a gentle ping. TYVM. :)

@justinretzolk
Copy link
Member

Hey @wcmjunior 👋 Thanks for checking in here! I can't speak to when this will be prioritized just yet. We base our prioritization on the count of 👍 reactions and a few other considerations (more information: prioritization guide).

@gabfelp
Copy link

gabfelp commented Apr 23, 2024

Thanks for working on this! I would love for it to be added to the AWS provider 🤯

@mikkoc
Copy link

mikkoc commented Jun 19, 2024

Can we please review and merge this? We need a way to list version IDs even if a secret has no versions (empty list would be returned). Right now there is not way of doing that :(

@wcmjunior
Copy link
Contributor Author

Can we please review and merge this? We need a way to list version IDs even if a secret has no versions (empty list would be returned). Right now there is not way of doing that :(

Hey @mikkoc , I don't think this is going to happen due to this check, but I'd need to test to make sure. I agree with you that is better to return an empty list and not fail in case no versions are found, otherwise there is no point on having a data source as it could fail and break the execution.

I will try to take a look at this during the week and get back with a solution. @ulrichwinter , please LMK if you have any thoughts on the proper behaviour for the data source.

I just tested and it does not fail for a non-existing version, so the data source is good to go. 🙏

I added a test case for it, but I'm afraid that pushing the 32 lines of code with the new test will delay this PR even further. Will tackle this issue in a different PR that could eventually live forever in the backlog.

@wcmjunior
Copy link
Contributor Author

Hey @justinretzolk. It would help a lot if this PR could be merged as it is already reviewed. Gentle ping again. :-)

@mikkoc
Copy link

mikkoc commented Jul 19, 2024

yes, please let's get this merged ASAP. 🙏

@wcmjunior wcmjunior requested a review from a team as a code owner July 23, 2024 21:54
@wcmjunior
Copy link
Contributor Author

Just realized the review is not from a contributor (although I appreciate it), so decide to add a new test case as this may take a long time to be merged anyways.

@nam054 nam054 self-assigned this Aug 7, 2024
@github-actions github-actions bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Aug 7, 2024
Copy link
Contributor

@nam054 nam054 left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀 Thank you so much for your contribution!

> make testacc TESTS=TestAccSecretsManagerSecretVersionsDataSource_ PKG=secretsmanager
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.5 test ./internal/service/secretsmanager/... -v -count 1 -parallel 20 -run='TestAccSecretsManagerSecretVersionsDataSource_'  -timeout 360m
=== RUN   TestAccSecretsManagerSecretVersionsDataSource_basic
=== PAUSE TestAccSecretsManagerSecretVersionsDataSource_basic
=== RUN   TestAccSecretsManagerSecretVersionsDataSource_emptyVer
=== PAUSE TestAccSecretsManagerSecretVersionsDataSource_emptyVer
=== CONT  TestAccSecretsManagerSecretVersionsDataSource_basic
=== CONT  TestAccSecretsManagerSecretVersionsDataSource_emptyVer
--- PASS: TestAccSecretsManagerSecretVersionsDataSource_emptyVer (11.86s)
--- PASS: TestAccSecretsManagerSecretVersionsDataSource_basic (12.62s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/secretsmanager     18.436s

@nam054 nam054 merged commit a1d361f into hashicorp:main Aug 8, 2024
41 checks passed
@github-actions github-actions bot added this to the v5.62.0 milestone Aug 8, 2024
@wcmjunior wcmjunior deleted the f-aws_secretsmanager_secret_versions branch August 8, 2024 05:41
@wcmjunior
Copy link
Contributor Author

@nam054 thanks for reviewing and merging the feature. I really need it. A bit disappointing to see the contribution is not computed to the original PR author, but the feature availability is more important for me now. :-)

@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Aug 9, 2024
Copy link

github-actions bot commented Aug 9, 2024

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

@mikkoc
Copy link

mikkoc commented Aug 12, 2024

@nam054 thanks for reviewing and merging the feature. I really need it. A bit disappointing to see the contribution is not computed to the original PR author, but the feature availability is more important for me now. :-)

this worked very well, thanks @wcmjunior . Only one minor note: the docs need to be updated. According to the docs, we should call versions.version_stage to get the stage. Instead, we need version.version_stages because it's a list, not a string.

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 Sep 12, 2024
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. generators Relates to code generators. new-data-source Introduces a new data source. service/secretsmanager Issues and PRs that pertain to the secretsmanager service. size/XL 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.

[New Data Source]: aws_secretsmanager_secret_versions / aws_secretsmanager_secret_version_ids
6 participants