-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Conversation
Community NoteVoting for Prioritization
For Submitters
|
return | ||
} | ||
|
||
in := lakeformation.CreateLakeFormationOptInInput{} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 != "" { |
There was a problem hiding this comment.
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.
}, | ||
} | ||
|
||
for path, constructor := range resourceConstructors { |
There was a problem hiding this comment.
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{ |
There was a problem hiding this comment.
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?
There was a problem hiding this 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
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! |
Description
Relations
Closes #36353
References
Output from Acceptance Testing