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_securityhub_standards_control_associations: new data source #39334

Merged

Conversation

kamilturek
Copy link
Collaborator

@kamilturek kamilturek commented Sep 14, 2024

Description

This PR adds a aws_securityhub_standards_control_associations plural data source.

Relations

Relates #33082.

References

https://docs.aws.amazon.com/securityhub/1.0/APIReference/API_ListStandardsControlAssociations.html

Output from Acceptance Testing

% make testacc PKG=securityhub ACCTEST_PARALLELISM=1 TESTARGS="-run=TestAccSecurityHub_serial"
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.6 test ./internal/service/securityhub/... -v -count 1 -parallel 1  -run=TestAccSecurityHub_serial -timeout 360m
=== RUN   TestAccSecurityHub_serial
=== PAUSE TestAccSecurityHub_serial
=== CONT  TestAccSecurityHub_serial
=== RUN   TestAccSecurityHub_serial/StandardsAssociationsDataSource
=== RUN   TestAccSecurityHub_serial/StandardsAssociationsDataSource/basic
--- PASS: TestAccSecurityHub_serial (41.63s)
    --- PASS: TestAccSecurityHub_serial/StandardsAssociationsDataSource (41.63s)
        --- PASS: TestAccSecurityHub_serial/StandardsAssociationsDataSource/basic (41.63s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/securityhub        46.440s

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 documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/securityhub Issues and PRs that pertain to the securityhub service. generators Relates to code generators. labels Sep 14, 2024
@kamilturek kamilturek changed the title d/aws_standards_control_associations: new data source d/aws_securityhub_standards_control_associations: new data source Sep 14, 2024
@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. external-maintainer Contribution from a trusted external contributor. labels Sep 14, 2024
@kamilturek kamilturek marked this pull request as ready for review September 15, 2024 10:34
@kamilturek kamilturek requested a review from a team as a code owner September 15, 2024 10:34
@jar-b jar-b removed the needs-triage Waiting for first response or review from a maintainer. label Sep 16, 2024
Copy link
Member

@jar-b jar-b left a comment

Choose a reason for hiding this comment

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

Hi @kamilturek - Thanks for your submission!

As of 2023-10-20 we've started to require all net-new data sources use Terraform Plugin Framework.

#32917
https://hashicorp.github.io/terraform-provider-aws/terraform-plugin-development-packages/#which-plugin-version-should-i-use

Maintainers will convert Plugin-SDK based data sources as part of the review process, but if you'd like to do the conversion in the meantime we would greatly appreciate it!

@kamilturek
Copy link
Collaborator Author

Hey @jar-b, I'll convert it to the framework. Thanks for letting me know!

…ol_associations attribute

This list attribute stores all fields returned from the `ListStandardsControlAssociations` API.

```console
% make testacc PKG=securityhub TESTS=TestAccSecurityHub_serial/StandardsControlAssociationsDataSource
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.7 test ./internal/service/securityhub/... -v -count 1 -parallel 20 -run='TestAccSecurityHub_serial/StandardsControlAssociationsDataSource'  -timeout 360m

--- PASS: TestAccSecurityHub_serial (80.24s)
    --- PASS: TestAccSecurityHub_serial/StandardsControlAssociationsDataSource (80.24s)
        --- PASS: TestAccSecurityHub_serial/StandardsControlAssociationsDataSource/basic (80.24s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/securityhub        86.762s
```
Copy link
Member

@jar-b jar-b 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 PKG=securityhub TESTS=TestAccSecurityHub_serial/StandardsControlAssociationsDataSource
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.7 test ./internal/service/securityhub/... -v -count 1 -parallel 20 -run='TestAccSecurityHub_serial/StandardsControlAssociationsDataSource'  -timeout 360m
=== RUN   TestAccSecurityHub_serial
=== PAUSE TestAccSecurityHub_serial
=== CONT  TestAccSecurityHub_serial
=== RUN   TestAccSecurityHub_serial/StandardsControlAssociationsDataSource
=== RUN   TestAccSecurityHub_serial/StandardsControlAssociationsDataSource/basic
--- PASS: TestAccSecurityHub_serial (63.09s)
    --- PASS: TestAccSecurityHub_serial/StandardsControlAssociationsDataSource (63.09s)
        --- PASS: TestAccSecurityHub_serial/StandardsControlAssociationsDataSource/basic (63.09s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/securityhub        69.256s

@jar-b
Copy link
Member

jar-b commented Sep 18, 2024

Thanks for your contribution, @kamilturek! 👍

Just adjusted the result slightly to include the full object returned from the ListStandardsControlAssociations API, rather than pulling out just the standards ARN.

@jar-b jar-b merged commit 58e8397 into hashicorp:main Sep 18, 2024
40 checks passed
@github-actions github-actions bot added this to the v5.68.0 milestone Sep 18, 2024
@kamilturek kamilturek deleted the f-data-aws-standards-control-associations branch September 18, 2024 20:18
@kamilturek
Copy link
Collaborator Author

kamilturek commented Sep 18, 2024

@jar-b

I followed the common approach for plural data sources and pulled just a list of attributes (e.g. arns, names - like in here) but I agree having full objects is way better. Thanks a lot for help!

@jar-b
Copy link
Member

jar-b commented Sep 18, 2024

Totally understandable! There are a bunch of older resources which only return a subset of the API response fields. This is great for simplicity, but for new resources/data sources we tend to stick with matching the AWS API as close as possible to make it easier for users to translate between other interfaces (such as the AWS CLI or API documentation) and Terraform.

By no means meant to criticize the initial implementation, just to give some context to why the attributes changed. Thanks again for adding this! 👍

Copy link

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

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 22, 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. external-maintainer Contribution from a trusted external contributor. generators Relates to code generators. service/securityhub Issues and PRs that pertain to the securityhub service. 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