-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
[New Resource]: DataZone Project #38345
Conversation
Community NoteVoting for Prioritization
For Submitters
|
Thank you for your contribution! 🚀 A new usage of AWS SDK for Go V1 was detected. Please prefer AWS SDK for Go V2 for all net-new services. If this is an enhancement or bug fix to an existing AWS SDK Go V1 based resource, this comment can be safely ignored. For additional information refer to the AWS SDK for Go Versions page in the contributor guide. |
internal/service/datazone/project.go
Outdated
in := &datazone.CreateProjectInput{ | ||
Name: aws.String(plan.Name.ValueString()), | ||
DomainIdentifier: aws.String(plan.DomainId.ValueString()), | ||
} | ||
if !plan.Description.IsNull() { | ||
in.Description = aws.String(plan.Description.ValueString()) | ||
} | ||
if !plan.GlossaryTerms.IsNull() { | ||
in.GlossaryTerms = aws.ToStringSlice(flex.ExpandFrameworkStringList(ctx, plan.GlossaryTerms)) | ||
} |
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.
We should use flex.Expand
here. AutoFlex should work in this situation, which will reduce some lines of code
internal/service/datazone/project.go
Outdated
|
||
var validateDomain datazone.GetDomainInput | ||
validateDomain.Identifier = plan.DomainId.ValueStringPointer() | ||
_, err := conn.GetDomain(ctx, &validateDomain) |
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.
we should avoid doing read operations in the Create
handler since the single operation here should be to create. In this case we can count on the AWS API returning an appropriate error if the domain_id
is not correct when creating.
internal/service/datazone/project.go
Outdated
return | ||
} | ||
|
||
if plan.DomainId != state.DomainId { |
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 Plugin Framework provides builtin functions for checking equality: plan.DomainId.Equals(state.DomainId)
will do equality checks for both Null
and Unknown
values.
We should also try to use flex.Expand
here as well. internal/services/opensearchserverless/access_policy.go
has a pretty good pattern for doing these equality checks, along with autoFlex.
acctest.CheckFrameworkResourceDisappears(ctx, acctest.Provider, tfdatazone.ResourceProject, resourceName), | ||
), | ||
ExpectNonEmptyPlan: true, | ||
//ExpectError: regexache.MustCompile(`(AccessDeniedException)`), |
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.
cleanup
Removed aws.String Co-authored-by: Adrian Johnson <adrian.johnson@hashicorp.com>
Co-authored-by: Adrian Johnson <adrian.johnson@hashicorp.com>
Co-authored-by: Adrian Johnson <adrian.johnson@hashicorp.com>
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 TESTARGS="-run=TestAccDataZoneProject_" PKG=datazone
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.4 test ./internal/service/datazone/... -v -count 1 -parallel 20 -run=TestAccDataZoneProject_ -timeout 360m
--- PASS: TestAccDataZoneProject_disappears (30.21s)
--- PASS: TestAccDataZoneProject_basic (31.94s)
--- PASS: TestAccDataZoneProject_update (43.98s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/datazone 48.696s
This functionality has been released in v5.59.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! |
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. |
Description
This resource will allow practitioners to create DataZone Projects for a DataZone Domain via Terraform.
Relations
Relates #37423
Closes #38231
References
https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/datazone
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-datazone-project.html
Output from Acceptance Testing