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

F/ New Resource Lakeformation OptIn #41611

Merged
merged 18 commits into from
Mar 4, 2025
Merged

F/ New Resource Lakeformation OptIn #41611

merged 18 commits into from
Mar 4, 2025

Conversation

nam054
Copy link
Contributor

@nam054 nam054 commented Feb 28, 2025

Description

Relations

Closes #36353

References

Output from Acceptance Testing

> make testacc PKG=lakeformation TESTS=TestAccLakeFormationOptIn_
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.5 test ./internal/service/lakeformation/... -v -count 1 -parallel 20 -run='TestAccLakeFormationOptIn_'  -timeout 360m -vet=off
2025/03/03 02:43:10 Initializing Terraform AWS Provider...
=== RUN   TestAccLakeFormationOptIn_basic
=== PAUSE TestAccLakeFormationOptIn_basic
=== RUN   TestAccLakeFormationOptIn_disappears
=== PAUSE TestAccLakeFormationOptIn_disappears
=== CONT  TestAccLakeFormationOptIn_basic
=== CONT  TestAccLakeFormationOptIn_disappears
--- PASS: TestAccLakeFormationOptIn_basic (24.46s)
--- PASS: TestAccLakeFormationOptIn_disappears (24.47s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/lakeformation      31.403s

...

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/lakeformation Issues and PRs that pertain to the lakeformation service. generators Relates to code generators. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. labels Feb 28, 2025
@nam054 nam054 marked this pull request as ready for review March 3, 2025 06:30
@nam054 nam054 requested a review from a team as a code owner March 3, 2025 06:30
@ewbankkit ewbankkit added the new-resource Introduces a new resource. label Mar 3, 2025
return
}

in := lakeformation.CreateLakeFormationOptInInput{}
Copy link
Member

Choose a reason for hiding this comment

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

Calling it an "opt in" blurs the line with a verb but the API is using it as a noun so it seems fine to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could I get clarification? Rename the in to opt_in?
The in is part of the generated naming convention of the input.

Copy link
Member

@YakDriver YakDriver Mar 4, 2025

Choose a reason for hiding this comment

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

Oh, sorry for the confusion! The name aws_lakeformation_opt_in is fine. I just meant that some might find "opt in" tricky since it can be both a verb and a noun. However, since AWS uses it as a noun (e.g., "create an opt-in"), it seems perfectly fine to me.

Resource: &awstypes.Resource{},
}

if v, ok := rs.Primary.Attributes["resource_data.0.catalog.0.id"]; ok && v != "" {
Copy link
Member

Choose a reason for hiding this comment

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

The way this works is a bit of a mess and if-else is one way to handle it. Idiomatic Go tries to avoid else entirely, however. I propose either switching to a switch or a separate return-early function that takes the attributes and returns the resource.

YakDriver
YakDriver previously approved these changes Mar 4, 2025
},
}

for path, constructor := range resourceConstructors {
Copy link
Member

Choose a reason for hiding this comment

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

That's a cool approach!


type resourceConstructor func(*terraform.ResourceState) *awstypes.Resource

resourceConstructors := map[string]resourceConstructor{
Copy link
Member

Choose a reason for hiding this comment

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

Could both of these be in a separate function so they can be shared by exists and destroy?

Copy link
Member

@YakDriver YakDriver 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=lakeformation TESTS=TestAccLakeFormationOptIn_
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.5 test ./internal/service/lakeformation/... -v -count 1 -parallel 20 -run='TestAccLakeFormationOptIn_'  -timeout 360m -vet=off
go: downloading github.com/aws/aws-sdk-go-v2/service/databasemigrationservice v1.50.0
go: downloading github.com/aws/aws-sdk-go-v2/service/eks v1.59.0
go: downloading github.com/aws/aws-sdk-go-v2/service/mediaconvert v1.68.0
go: downloading github.com/aws/aws-sdk-go-v2/service/pricing v1.33.0
go: downloading github.com/aws/aws-sdk-go-v2/service/ssm v1.57.0
2025/03/04 16:46:35 Initializing Terraform AWS Provider...
=== RUN   TestAccLakeFormationOptIn_basic
=== PAUSE TestAccLakeFormationOptIn_basic
=== RUN   TestAccLakeFormationOptIn_disappears
=== PAUSE TestAccLakeFormationOptIn_disappears
=== CONT  TestAccLakeFormationOptIn_basic
=== CONT  TestAccLakeFormationOptIn_disappears
--- PASS: TestAccLakeFormationOptIn_disappears (33.96s)
--- PASS: TestAccLakeFormationOptIn_basic (34.01s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/lakeformation	38.437s

@nam054 nam054 merged commit 1316652 into main Mar 4, 2025
44 checks passed
@nam054 nam054 deleted the f-lakeformation-opt-in branch March 4, 2025 21:59
@github-actions github-actions bot added this to the v5.90.0 milestone Mar 4, 2025
terraform-aws-provider bot pushed a commit that referenced this pull request Mar 4, 2025
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Mar 6, 2025
Copy link

github-actions bot commented Mar 6, 2025

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

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. generators Relates to code generators. new-resource Introduces a new resource. service/lakeformation Issues and PRs that pertain to the lakeformation 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]: support for aws_lakeformation_permissions hybrid mode opt-in
3 participants