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

feat(datazone): add domain and environment blueprint configuration resources #36600

Merged
merged 1 commit into from
May 3, 2024

Conversation

cogwirrel
Copy link
Contributor

@cogwirrel cogwirrel commented Mar 27, 2024

Description

Add resources for DataZone:

  • Domain
  • Environment Blueprint Configuration

Additionally add a data source for Environment Blueprints in order to retrieve the IDs of managed blueprints without hardcoding.

Relations

Relates #33792

References

https://docs.aws.amazon.com/datazone/latest/userguide/datazone-concepts.html

Output from Acceptance Testing

$ AWS_REGION=ap-southeast-2 AWS_PROFILE=default make testacc TESTS=TestAccDataZone PKG=datazone
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.21.8 test ./internal/service/datazone/... -v -count 1 -parallel 20 -run='TestAccDataZone'  -timeout 360m
=== RUN   TestAccDataZoneDomain_basic
=== PAUSE TestAccDataZoneDomain_basic
=== RUN   TestAccDataZoneDomain_disappears
=== PAUSE TestAccDataZoneDomain_disappears
=== RUN   TestAccDataZoneDomain_kms_key_identifier
=== PAUSE TestAccDataZoneDomain_kms_key_identifier
=== RUN   TestAccDataZoneDomain_description
=== PAUSE TestAccDataZoneDomain_description
=== RUN   TestAccDataZoneDomain_single_sign_on
=== PAUSE TestAccDataZoneDomain_single_sign_on
=== RUN   TestAccDataZoneDomain_tags
=== PAUSE TestAccDataZoneDomain_tags
=== RUN   TestAccDataZoneEnvironmentBlueprintConfiguration_basic
=== PAUSE TestAccDataZoneEnvironmentBlueprintConfiguration_basic
=== RUN   TestAccDataZoneEnvironmentBlueprintConfiguration_disappears
=== PAUSE TestAccDataZoneEnvironmentBlueprintConfiguration_disappears
=== RUN   TestAccDataZoneEnvironmentBlueprintConfiguration_enabled_regions
=== PAUSE TestAccDataZoneEnvironmentBlueprintConfiguration_enabled_regions
=== RUN   TestAccDataZoneEnvironmentBlueprintConfiguration_manage_access_role_arn
=== PAUSE TestAccDataZoneEnvironmentBlueprintConfiguration_manage_access_role_arn
=== RUN   TestAccDataZoneEnvironmentBlueprintConfiguration_provisioning_role_arn
=== PAUSE TestAccDataZoneEnvironmentBlueprintConfiguration_provisioning_role_arn
=== RUN   TestAccDataZoneEnvironmentBlueprintConfiguration_regional_parameters
=== PAUSE TestAccDataZoneEnvironmentBlueprintConfiguration_regional_parameters
=== RUN   TestAccDataZoneEnvironmentBlueprintDataSource_basic
=== PAUSE TestAccDataZoneEnvironmentBlueprintDataSource_basic
=== CONT  TestAccDataZoneDomain_basic
=== CONT  TestAccDataZoneEnvironmentBlueprintConfiguration_disappears
=== CONT  TestAccDataZoneDomain_single_sign_on
=== CONT  TestAccDataZoneDomain_kms_key_identifier
=== CONT  TestAccDataZoneEnvironmentBlueprintConfiguration_regional_parameters
=== CONT  TestAccDataZoneDomain_tags
=== CONT  TestAccDataZoneDomain_description
=== CONT  TestAccDataZoneEnvironmentBlueprintConfiguration_manage_access_role_arn
=== CONT  TestAccDataZoneEnvironmentBlueprintConfiguration_enabled_regions
=== CONT  TestAccDataZoneDomain_disappears
=== CONT  TestAccDataZoneEnvironmentBlueprintConfiguration_basic
=== CONT  TestAccDataZoneEnvironmentBlueprintConfiguration_provisioning_role_arn
=== CONT  TestAccDataZoneEnvironmentBlueprintDataSource_basic
--- PASS: TestAccDataZoneDomain_basic (137.87s)
--- PASS: TestAccDataZoneDomain_single_sign_on (139.36s)
--- PASS: TestAccDataZoneDomain_disappears (139.67s)
--- PASS: TestAccDataZoneDomain_description (141.29s)
--- PASS: TestAccDataZoneEnvironmentBlueprintDataSource_basic (164.53s)
--- PASS: TestAccDataZoneDomain_kms_key_identifier (171.80s)
--- PASS: TestAccDataZoneEnvironmentBlueprintConfiguration_disappears (207.23s)
--- PASS: TestAccDataZoneEnvironmentBlueprintConfiguration_basic (210.45s)
--- PASS: TestAccDataZoneEnvironmentBlueprintConfiguration_provisioning_role_arn (220.59s)
--- PASS: TestAccDataZoneEnvironmentBlueprintConfiguration_manage_access_role_arn (220.66s)
--- PASS: TestAccDataZoneDomain_tags (233.04s)
--- PASS: TestAccDataZoneEnvironmentBlueprintConfiguration_enabled_regions (269.25s)
--- PASS: TestAccDataZoneEnvironmentBlueprintConfiguration_regional_parameters (269.30s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/datazone   275.038s

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 size/XL 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. generators Relates to code generators. service/datazone Issues and PRs that pertain to the datazone service. labels Mar 27, 2024
@terraform-aws-provider terraform-aws-provider bot added needs-triage Waiting for first response or review from a maintainer. partner Contribution from a partner. labels Mar 27, 2024
@cogwirrel cogwirrel force-pushed the feat/datazone-env-bp-config branch 4 times, most recently from 376e155 to 867c93e Compare March 27, 2024 06:24
@justinretzolk justinretzolk added new-resource Introduces a new resource. and removed needs-triage Waiting for first response or review from a maintainer. labels Apr 1, 2024
@cogwirrel cogwirrel force-pushed the feat/datazone-env-bp-config branch 4 times, most recently from 3ba66fa to fb99040 Compare April 2, 2024 07:32
@AdamTylerLynch AdamTylerLynch self-requested a review April 5, 2024 13:14
Copy link
Collaborator

@AdamTylerLynch AdamTylerLynch left a comment

Choose a reason for hiding this comment

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

Changes requested. I did not have time to review all files.


func (r *resourceDomain) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = schema.Schema{
Attributes: map[string]schema.Attribute{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Attributes should be defined in alphabetical order (not the order that the AWS API defines them in).

},
"portal_url": schema.StringAttribute{
Computed: true,
PlanModifiers: []planmodifier.String{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you explain why it was necessary to use stringplanmodifier.UseStateForUnknown(),?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's to save explicitly updating the state from the plan for this computed value in Update - if it's preferred that I do that I'm happy to update it though!

}

in := &datazone.CreateDomainInput{
Name: aws.String(plan.Name.ValueString()),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please alphabetize input parameters

in.SingleSignOn = expandSingleSignOn(tfList)
}

out, err := retryCreateDomain(ctx, conn, in, CreateNumRetries)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We typically prefer the retry logic to be inline, not in another function.

You can see a recent pattern for this here in the Bedrock Custom Model resource.

outputRaw, err := tfresource.RetryWhenAWSErrMessageContains(ctx, propagationTimeout, func() (interface{}, error) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah awesome thanks for pointing me to an example! Much cleaner 😄

return out, nil
}

func isResourceMissing(err error) bool {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Well done! I love the conciseness of this.

return apiObject
}

type resourceDomainData struct {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Naming convention is normally:

Model.

example: customModelResourceModel

Suggested change
type resourceDomainData struct {
type domainResourceModel struct {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah awesome, updated! :)

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package datazone_test
Copy link
Collaborator

Choose a reason for hiding this comment

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

Really nice job on the AccTests! The use of _basic for all required attributes, and then individual tests for each other attribute/feature provide lasting maintainability that is forward compatable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you! 😄

Required: true,
},
"manage_access_role_arn": schema.StringAttribute{
Optional: true,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Optional: true,
CustomType: fwtypes.ARNType,
Optional: true,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Updated :)

Optional: true,
},
"provisioning_role_arn": schema.StringAttribute{
Optional: true,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Optional: true,
CustomType: fwtypes.ARNType,
Optional: true,

@cogwirrel cogwirrel changed the title feat(datazone): add environment blueprint configuration resource feat(datazone): add domain and environment blueprint configuration resources Apr 6, 2024
…sources

Add resources for DataZone:

- Domain
- Environment Blueprint Configuration

Additionally add a data source for Environment Blueprints in order to retrieve the IDs of managed
blueprints without hardcoding.

Relates hashicorp#33792
@nsb413
Copy link

nsb413 commented Apr 22, 2024

Looking forward to Terraform support for Amazon Datazone.

Copy link
Collaborator

@AdamTylerLynch AdamTylerLynch left a comment

Choose a reason for hiding this comment

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

@cogwirrel can you please re-run all of the acceptance tests and provide the outputs?

@AdamTylerLynch
Copy link
Collaborator

 make testacc TESTS=TestAccDataZone PKG=datazone
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.21.8 test ./internal/service/datazone/... -v -count 1 -parallel 20 -run='TestAccDataZone'  -timeout 360m
=== RUN   TestAccDataZoneDomain_basic
=== PAUSE TestAccDataZoneDomain_basic
=== RUN   TestAccDataZoneDomain_disappears
=== PAUSE TestAccDataZoneDomain_disappears
=== RUN   TestAccDataZoneDomain_kms_key_identifier
=== PAUSE TestAccDataZoneDomain_kms_key_identifier
=== RUN   TestAccDataZoneDomain_description
=== PAUSE TestAccDataZoneDomain_description
=== RUN   TestAccDataZoneDomain_single_sign_on
=== PAUSE TestAccDataZoneDomain_single_sign_on
=== RUN   TestAccDataZoneDomain_tags
=== PAUSE TestAccDataZoneDomain_tags
=== RUN   TestAccDataZoneEnvironmentBlueprintConfiguration_basic
=== PAUSE TestAccDataZoneEnvironmentBlueprintConfiguration_basic
=== RUN   TestAccDataZoneEnvironmentBlueprintConfiguration_disappears
=== PAUSE TestAccDataZoneEnvironmentBlueprintConfiguration_disappears
=== RUN   TestAccDataZoneEnvironmentBlueprintConfiguration_enabled_regions
=== PAUSE TestAccDataZoneEnvironmentBlueprintConfiguration_enabled_regions
=== RUN   TestAccDataZoneEnvironmentBlueprintConfiguration_manage_access_role_arn
=== PAUSE TestAccDataZoneEnvironmentBlueprintConfiguration_manage_access_role_arn
=== RUN   TestAccDataZoneEnvironmentBlueprintConfiguration_provisioning_role_arn
=== PAUSE TestAccDataZoneEnvironmentBlueprintConfiguration_provisioning_role_arn
=== RUN   TestAccDataZoneEnvironmentBlueprintConfiguration_regional_parameters
=== PAUSE TestAccDataZoneEnvironmentBlueprintConfiguration_regional_parameters
=== RUN   TestAccDataZoneEnvironmentBlueprintDataSource_basic
=== PAUSE TestAccDataZoneEnvironmentBlueprintDataSource_basic
=== CONT  TestAccDataZoneDomain_basic
=== CONT  TestAccDataZoneEnvironmentBlueprintConfiguration_disappears
=== CONT  TestAccDataZoneEnvironmentBlueprintConfiguration_provisioning_role_arn
=== CONT  TestAccDataZoneEnvironmentBlueprintConfiguration_regional_parameters
=== CONT  TestAccDataZoneDomain_disappears
=== CONT  TestAccDataZoneEnvironmentBlueprintDataSource_basic
=== CONT  TestAccDataZoneEnvironmentBlueprintConfiguration_manage_access_role_arn
=== CONT  TestAccDataZoneDomain_single_sign_on
=== CONT  TestAccDataZoneEnvironmentBlueprintConfiguration_enabled_regions
=== CONT  TestAccDataZoneEnvironmentBlueprintConfiguration_basic
=== CONT  TestAccDataZoneDomain_kms_key_identifier
=== CONT  TestAccDataZoneDomain_description
=== CONT  TestAccDataZoneDomain_tags
--- PASS: TestAccDataZoneDomain_disappears (28.28s)
--- PASS: TestAccDataZoneEnvironmentBlueprintDataSource_basic (29.17s)
--- PASS: TestAccDataZoneEnvironmentBlueprintConfiguration_disappears (30.35s)
--- PASS: TestAccDataZoneDomain_single_sign_on (30.87s)
--- PASS: TestAccDataZoneDomain_basic (30.87s)
--- PASS: TestAccDataZoneEnvironmentBlueprintConfiguration_manage_access_role_arn (32.46s)
--- PASS: TestAccDataZoneEnvironmentBlueprintConfiguration_provisioning_role_arn (32.71s)
--- PASS: TestAccDataZoneDomain_description (33.07s)
--- PASS: TestAccDataZoneDomain_kms_key_identifier (33.79s)
--- PASS: TestAccDataZoneEnvironmentBlueprintConfiguration_basic (35.13s)
--- PASS: TestAccDataZoneEnvironmentBlueprintConfiguration_regional_parameters (42.22s)
--- PASS: TestAccDataZoneEnvironmentBlueprintConfiguration_enabled_regions (45.80s)
--- PASS: TestAccDataZoneDomain_tags (49.42s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/datazone	55.041s

Copy link
Collaborator

@AdamTylerLynch AdamTylerLynch left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@YakDriver YakDriver self-assigned this May 3, 2024
@terraform-aws-provider terraform-aws-provider bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label May 3, 2024
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 t T=TestAccDataZone K=datazone
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.2 test ./internal/service/datazone/... -v -count 1 -parallel 20 -run='TestAccDataZone'  -timeout 360m
=== RUN   TestAccDataZoneDomain_basic
=== PAUSE TestAccDataZoneDomain_basic
=== RUN   TestAccDataZoneDomain_disappears
=== PAUSE TestAccDataZoneDomain_disappears
=== RUN   TestAccDataZoneDomain_kms_key_identifier
=== PAUSE TestAccDataZoneDomain_kms_key_identifier
=== RUN   TestAccDataZoneDomain_description
=== PAUSE TestAccDataZoneDomain_description
=== RUN   TestAccDataZoneDomain_single_sign_on
=== PAUSE TestAccDataZoneDomain_single_sign_on
=== RUN   TestAccDataZoneDomain_tags
=== PAUSE TestAccDataZoneDomain_tags
=== RUN   TestAccDataZoneEnvironmentBlueprintConfiguration_basic
=== PAUSE TestAccDataZoneEnvironmentBlueprintConfiguration_basic
=== RUN   TestAccDataZoneEnvironmentBlueprintConfiguration_disappears
=== PAUSE TestAccDataZoneEnvironmentBlueprintConfiguration_disappears
=== RUN   TestAccDataZoneEnvironmentBlueprintConfiguration_enabled_regions
=== PAUSE TestAccDataZoneEnvironmentBlueprintConfiguration_enabled_regions
=== RUN   TestAccDataZoneEnvironmentBlueprintConfiguration_manage_access_role_arn
=== PAUSE TestAccDataZoneEnvironmentBlueprintConfiguration_manage_access_role_arn
=== RUN   TestAccDataZoneEnvironmentBlueprintConfiguration_provisioning_role_arn
=== PAUSE TestAccDataZoneEnvironmentBlueprintConfiguration_provisioning_role_arn
=== RUN   TestAccDataZoneEnvironmentBlueprintConfiguration_regional_parameters
=== PAUSE TestAccDataZoneEnvironmentBlueprintConfiguration_regional_parameters
=== RUN   TestAccDataZoneEnvironmentBlueprintDataSource_basic
=== PAUSE TestAccDataZoneEnvironmentBlueprintDataSource_basic
=== CONT  TestAccDataZoneDomain_basic
=== CONT  TestAccDataZoneEnvironmentBlueprintConfiguration_disappears
=== CONT  TestAccDataZoneDomain_single_sign_on
=== CONT  TestAccDataZoneDomain_disappears
=== CONT  TestAccDataZoneEnvironmentBlueprintConfiguration_manage_access_role_arn
=== CONT  TestAccDataZoneEnvironmentBlueprintConfiguration_enabled_regions
=== CONT  TestAccDataZoneEnvironmentBlueprintDataSource_basic
=== CONT  TestAccDataZoneDomain_kms_key_identifier
=== CONT  TestAccDataZoneEnvironmentBlueprintConfiguration_regional_parameters
=== CONT  TestAccDataZoneDomain_description
=== CONT  TestAccDataZoneEnvironmentBlueprintConfiguration_basic
=== CONT  TestAccDataZoneDomain_tags
=== CONT  TestAccDataZoneEnvironmentBlueprintConfiguration_provisioning_role_arn
--- PASS: TestAccDataZoneDomain_disappears (43.25s)
--- PASS: TestAccDataZoneEnvironmentBlueprintDataSource_basic (43.40s)
--- PASS: TestAccDataZoneDomain_single_sign_on (45.28s)
--- PASS: TestAccDataZoneDomain_description (46.07s)
--- PASS: TestAccDataZoneEnvironmentBlueprintConfiguration_disappears (47.39s)
--- PASS: TestAccDataZoneDomain_basic (47.78s)
--- PASS: TestAccDataZoneDomain_kms_key_identifier (49.15s)
--- PASS: TestAccDataZoneEnvironmentBlueprintConfiguration_manage_access_role_arn (51.09s)
--- PASS: TestAccDataZoneEnvironmentBlueprintConfiguration_basic (51.34s)
--- PASS: TestAccDataZoneEnvironmentBlueprintConfiguration_provisioning_role_arn (51.52s)
--- PASS: TestAccDataZoneEnvironmentBlueprintConfiguration_regional_parameters (62.79s)
--- PASS: TestAccDataZoneEnvironmentBlueprintConfiguration_enabled_regions (65.12s)
--- PASS: TestAccDataZoneDomain_tags (72.36s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/datazone	74.834s

@YakDriver YakDriver merged commit ab11bda into hashicorp:main May 3, 2024
61 checks passed
@github-actions github-actions bot added this to the v5.49.0 milestone May 3, 2024
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label May 10, 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!

Copy link

github-actions bot commented Jun 9, 2024

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 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. generators Relates to code generators. new-resource Introduces a new resource. partner Contribution from a partner. service/datazone Issues and PRs that pertain to the datazone service. size/XL 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
Development

Successfully merging this pull request may close these issues.

5 participants