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

Fix: Set view_arn and other attrs properly for aws_resourcexplorer2_search data source #36778

Merged

Conversation

acwwat
Copy link
Contributor

@acwwat acwwat commented Apr 8, 2024

Description

This PR is to fix various functional issues with the aws_resourceexplorer2_search data source, including:

  • Panic due to mismatched attributes between Terraform and AWS type/schema - see [Bug]: aws_resourceexplorer2_search panic #36720
  • Various attributes not set by auto flattening due to mismatched attributes between Terraform and AWS type/schema
  • Data source state is not persisted at all
  • view_arn argument not used in the AWS API call

HELP NEEDED FROM MAINTAINERS: While I am able to fix most of the problems, I am still not able to get the resource.*.properties.*.data attribute to persist. The data type for Data is JSON, and I tried to use terraform-plugin-framework-jsontypes to no avail. I believe it is because the AWS return type is an actual object and not a JSON string. With the Terraform Plugin Framework, I am not sure how we can properly map the data to Terraform types. I can only think of using a Dynamic data type or somehow encode the JSON and store it as so, since there's no set schema with Data. I would like a maintainer to assist with fixing this case - let me know how else I can help. Thanks.

Relations

Closes #36720
Closes #36721

References

Output from Acceptance Testing

$ make testacc TESTS=TestAccResourceExplorer2_serial/SearchDataSource/basic PKG=resourceexplorer2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/resourceexplorer2/... -v -count 1 -parallel 20 -run='TestAccResourceExplorer2_serial/SearchDataSource/basic'  -timeout 360m
=== RUN   TestAccResourceExplorer2_serial
=== PAUSE TestAccResourceExplorer2_serial
=== CONT  TestAccResourceExplorer2_serial
=== RUN   TestAccResourceExplorer2_serial/SearchDataSource
=== RUN   TestAccResourceExplorer2_serial/SearchDataSource/basic
--- PASS: TestAccResourceExplorer2_serial (59.36s)
    --- PASS: TestAccResourceExplorer2_serial/SearchDataSource (59.36s)
        --- PASS: TestAccResourceExplorer2_serial/SearchDataSource/basic (59.36s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/resourceexplorer2  59.543s

$

Copy link

github-actions bot commented Apr 8, 2024

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/L Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/resourceexplorer2 Issues and PRs that pertain to the resourceexplorer2 service. labels Apr 8, 2024
@terraform-aws-provider terraform-aws-provider bot added needs-triage Waiting for first response or review from a maintainer. external-maintainer Contribution from a trusted external contributor. labels Apr 8, 2024
@acwwat acwwat force-pushed the b-aws_resourceexplorer2_search-view_arn_not_used branch from 05cf754 to 8e8925d Compare April 8, 2024 02:21
@acwwat
Copy link
Contributor Author

acwwat commented Apr 8, 2024

@jar-b As you were involved in reviewing #36560 originally, I was wondering if you could also review this PR and provide assistance per the description I put regarding the data attribute. Please let me know, thanks!

@acwwat acwwat force-pushed the b-aws_resourceexplorer2_search-view_arn_not_used branch from 8e8925d to 536afb6 Compare April 8, 2024 02:32
@acwwat acwwat force-pushed the b-aws_resourceexplorer2_search-view_arn_not_used branch from 536afb6 to e7114e2 Compare April 8, 2024 02:44
@acwwat acwwat marked this pull request as draft April 8, 2024 03:47
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Apr 8, 2024
@acwwat acwwat marked this pull request as ready for review April 17, 2024 17:11
@nam054
Copy link
Contributor

nam054 commented May 9, 2024

LGTM 🚀 Thank you for your contribution!
The following in Autoflex should now handle the conversion for the resource.*.properties.*.data attribute. It handles the conversion of the Document.Interface JSON type.
Please let us know if the issue persists.

> make testacc TESTARGS="-run=TestAccResourceExplorer2_serial/SearchDataSource" PKG=resourceexplorer2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.2 test ./internal/service/resourceexplorer2/... -v -count 1 -parallel 20  -run=TestAccResourceExplorer2_serial/SearchDataSource -timeout 360m
=== RUN   TestAccResourceExplorer2_serial
=== PAUSE TestAccResourceExplorer2_serial
=== CONT  TestAccResourceExplorer2_serial
=== RUN   TestAccResourceExplorer2_serial/SearchDataSource
=== RUN   TestAccResourceExplorer2_serial/SearchDataSource/basic
=== RUN   TestAccResourceExplorer2_serial/SearchDataSource/indexType
--- PASS: TestAccResourceExplorer2_serial (54.30s)
    --- PASS: TestAccResourceExplorer2_serial/SearchDataSource (54.30s)
        --- PASS: TestAccResourceExplorer2_serial/SearchDataSource/basic (15.80s)
        --- PASS: TestAccResourceExplorer2_serial/SearchDataSource/indexType (38.50s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/resourceexplorer2  59.469s

@nam054 nam054 changed the title [WIP] fix: Set view_arn and other attrs properly for aws_resourcexplorer2_search data source Fix: Set view_arn and other attrs properly for aws_resourcexplorer2_search data source May 9, 2024
@nam054 nam054 merged commit 4f5ca45 into hashicorp:main May 9, 2024
52 checks passed
@github-actions github-actions bot added this to the v5.49.0 milestone May 9, 2024
Copy link

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

@acwwat acwwat deleted the b-aws_resourceexplorer2_search-view_arn_not_used branch May 18, 2024 17:08
@acwwat acwwat restored the b-aws_resourceexplorer2_search-view_arn_not_used branch May 18, 2024 17:09
@acwwat acwwat deleted the b-aws_resourceexplorer2_search-view_arn_not_used branch May 18, 2024 17:11
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 19, 2024
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. documentation Introduces or discusses updates to documentation. external-maintainer Contribution from a trusted external contributor. service/resourceexplorer2 Issues and PRs that pertain to the resourceexplorer2 service. size/L 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
3 participants