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

b/aws_resourceexplorer2_index error create AGGREGATOR index and r/aws_resourceexplorer2_view new argument: scope #39744

Merged

Conversation

alexbacchin
Copy link
Contributor

@alexbacchin alexbacchin commented Oct 16, 2024

Description

This PR:

  • aws_resourceexplorer2_index fixes Resource Explorer Index creation issue when type is AGGREGATOR during cool down period. The dangling LOCAL index is deleted for eventual consistency.
  • aws_resourceexplorer2_view adds the scope argument allowing including resources from the AWS Organization or its organization units.

Relations

Closes #34411

References

https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-aggregator-region-turn-on.html

Output from Acceptance Testing

The testAccIndex_disappears and testAccView_disappears are failing before even raising this PR. I could not fix these, so they were skipped from the test results below.

% make testacc TESTS=TestAccResourceExplorer2_serial PKG=resourceexplorer2
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.2 test ./internal/service/resourceexplorer2/... -v -count 1 -parallel 20 -run='TestAccResourceExplorer2_serial'  -timeout 360m
2024/10/16 21:36:34 Initializing Terraform AWS Provider...
=== RUN   TestAccResourceExplorer2_serial
=== RUN   TestAccResourceExplorer2_serial/Index
=== RUN   TestAccResourceExplorer2_serial/Index/basic
=== RUN   TestAccResourceExplorer2_serial/Index/tags
=== RUN   TestAccResourceExplorer2_serial/Index/type
=== RUN   TestAccResourceExplorer2_serial/View
=== RUN   TestAccResourceExplorer2_serial/View/defaultView
=== RUN   TestAccResourceExplorer2_serial/View/filter
=== RUN   TestAccResourceExplorer2_serial/View/scope
=== RUN   TestAccResourceExplorer2_serial/View/tags
=== RUN   TestAccResourceExplorer2_serial/SearchDataSource
=== RUN   TestAccResourceExplorer2_serial/SearchDataSource/basic
=== RUN   TestAccResourceExplorer2_serial/SearchDataSource/indexType
    search_data_source_test.go:59: Environment variable RESOURCEEXPLORER_INDEX_TYPE is not set to AGGREGATOR. Before setting this environment variable and running this test, ensure no tests with a LOCAL index type also need to run. Changing the index type will trigger a cool down period of 24 hours.
--- PASS: TestAccResourceExplorer2_serial (338.35s)
    --- PASS: TestAccResourceExplorer2_serial/Index (146.95s)
        --- PASS: TestAccResourceExplorer2_serial/Index/basic (38.99s)
        --- PASS: TestAccResourceExplorer2_serial/Index/tags (49.85s)
        --- PASS: TestAccResourceExplorer2_serial/Index/type (58.12s)
    --- PASS: TestAccResourceExplorer2_serial/View (169.62s)
        --- PASS: TestAccResourceExplorer2_serial/View/defaultView (53.97s)
        --- PASS: TestAccResourceExplorer2_serial/View/filter (38.27s)
        --- PASS: TestAccResourceExplorer2_serial/View/scope (25.16s)
        --- PASS: TestAccResourceExplorer2_serial/View/tags (52.23s)
    --- PASS: TestAccResourceExplorer2_serial/SearchDataSource (21.78s)
        --- PASS: TestAccResourceExplorer2_serial/SearchDataSource/basic (21.78s)
        --- SKIP: TestAccResourceExplorer2_serial/SearchDataSource/indexType (0.00s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/resourceexplorer2  338.430s

...

…ted index creation issue during cool down period
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/resourceexplorer2 Issues and PRs that pertain to the resourceexplorer2 service. needs-triage Waiting for first response or review from a maintainer. labels Oct 16, 2024
@alexbacchin alexbacchin changed the title b/aws_resourceexplorer2_index error create aggregated index and r/aws_resourceexplorer2_view added scope argument b/aws_resourceexplorer2_index error create aggregated index and r/aws_resourceexplorer2_view new argument: scope Oct 16, 2024
@alexbacchin alexbacchin changed the title b/aws_resourceexplorer2_index error create aggregated index and r/aws_resourceexplorer2_view new argument: scope b/aws_resourceexplorer2_index error create AGGREGATOR index and r/aws_resourceexplorer2_view new argument: scope Oct 16, 2024
@alexbacchin alexbacchin marked this pull request as ready for review October 16, 2024 11:56
@alexbacchin alexbacchin requested a review from a team as a code owner October 16, 2024 11:56
@ewbankkit ewbankkit 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 Oct 16, 2024
@ewbankkit ewbankkit self-assigned this Oct 16, 2024
@github-actions github-actions bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Oct 16, 2024
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=TestAccResourceExplorer2_serial/^Index$$' PKG=resourceexplorer2
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.2 test ./internal/service/resourceexplorer2/... -v -count 1 -parallel 20  -run=TestAccResourceExplorer2_serial/^Index$ -timeout 360m
2024/10/16 09:56:44 Initializing Terraform AWS Provider...
=== RUN   TestAccResourceExplorer2_serial
=== RUN   TestAccResourceExplorer2_serial/Index
=== RUN   TestAccResourceExplorer2_serial/Index/basic
=== RUN   TestAccResourceExplorer2_serial/Index/disappears
=== RUN   TestAccResourceExplorer2_serial/Index/tags
=== RUN   TestAccResourceExplorer2_serial/Index/type
--- PASS: TestAccResourceExplorer2_serial (107.44s)
    --- PASS: TestAccResourceExplorer2_serial/Index (107.44s)
        --- PASS: TestAccResourceExplorer2_serial/Index/basic (16.08s)
        --- PASS: TestAccResourceExplorer2_serial/Index/disappears (12.93s)
        --- PASS: TestAccResourceExplorer2_serial/Index/tags (29.40s)
        --- PASS: TestAccResourceExplorer2_serial/Index/type (49.90s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/resourceexplorer2	112.658s
% make testacc TESTARGS='-run=TestAccResourceExplorer2_serial/^View$$' PKG=resourceexplorer2
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.2 test ./internal/service/resourceexplorer2/... -v -count 1 -parallel 20  -run=TestAccResourceExplorer2_serial/^View$ -timeout 360m
2024/10/16 10:19:53 Initializing Terraform AWS Provider...
=== RUN   TestAccResourceExplorer2_serial
=== RUN   TestAccResourceExplorer2_serial/View
=== RUN   TestAccResourceExplorer2_serial/View/basic
=== RUN   TestAccResourceExplorer2_serial/View/defaultView
=== RUN   TestAccResourceExplorer2_serial/View/disappears
=== RUN   TestAccResourceExplorer2_serial/View/filter
=== RUN   TestAccResourceExplorer2_serial/View/scope
=== RUN   TestAccResourceExplorer2_serial/View/tags
--- PASS: TestAccResourceExplorer2_serial (138.69s)
    --- PASS: TestAccResourceExplorer2_serial/View (138.69s)
        --- PASS: TestAccResourceExplorer2_serial/View/basic (16.42s)
        --- PASS: TestAccResourceExplorer2_serial/View/defaultView (31.37s)
        --- PASS: TestAccResourceExplorer2_serial/View/disappears (14.51s)
        --- PASS: TestAccResourceExplorer2_serial/View/filter (23.88s)
        --- PASS: TestAccResourceExplorer2_serial/View/scope (21.43s)
        --- PASS: TestAccResourceExplorer2_serial/View/tags (31.07s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/resourceexplorer2	143.683s

@ewbankkit
Copy link
Contributor

@alexbacchin Thanks for the contribution 🎉 👏.
I fixed the failing acceptance tests (they had been failing in our CI for a while).
Instead of deleting the created index if the update fails we prefer to mark the resource as "tainted" -- the resource ID is stored in state and subsequent applies will delete the resource.
Because of differences between Terraform Plugin SDK and Terraform Plugin Framework we need to explicitly set the ID in State on "partial failure".

@ewbankkit ewbankkit merged commit 8cbca09 into hashicorp:main Oct 16, 2024
39 of 40 checks passed
@github-actions github-actions bot added this to the v5.73.0 milestone Oct 16, 2024
@johnsonaj johnsonaj modified the milestones: v5.73.0, v5.72.1 Oct 16, 2024
Copy link

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

@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. service/resourceexplorer2 Issues and PRs that pertain to the resourceexplorer2 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.

[Enhancement]: Add scope to aws_resourceexplorer2_view for multi-account search
3 participants