diff --git a/internal/service/datazone/environment_profile.go b/internal/service/datazone/environment_profile.go index 3bc364aa387..c704497cfc5 100644 --- a/internal/service/datazone/environment_profile.go +++ b/internal/service/datazone/environment_profile.go @@ -138,7 +138,6 @@ func (r *resourceEnvironmentProfile) Create(ctx context.Context, req resource.Cr return } - option := flex.WithIgnoredFieldNames([]string{"UserParameters"}) in := &datazone.CreateEnvironmentProfileInput{} in.EnvironmentBlueprintIdentifier = plan.EnvironmentBlueprintId.ValueStringPointer() resp.Diagnostics.Append(flex.Expand(ctx, &plan, in)...) @@ -162,6 +161,7 @@ func (r *resourceEnvironmentProfile) Create(ctx context.Context, req resource.Cr return } + option := flex.WithIgnoredFieldNamesAppend("UserParameters") resp.Diagnostics.Append(flex.Flatten(ctx, out, &plan, option)...) if resp.Diagnostics.HasError() { return @@ -226,7 +226,7 @@ func (r *resourceEnvironmentProfile) Update(ctx context.Context, req resource.Up ) return } - option := flex.WithIgnoredFieldNames([]string{"UserParameters"}) + option := flex.WithIgnoredFieldNamesAppend("UserParameters") resp.Diagnostics.Append(flex.Flatten(ctx, out, &state, option)...) if resp.Diagnostics.HasError() { return @@ -257,7 +257,7 @@ func (r *resourceEnvironmentProfile) Delete(ctx context.Context, req resource.De func (r *resourceEnvironmentProfile) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { parts := strings.Split(req.ID, ",") - if len(parts) != 4 { + if len(parts) != 2 { resp.Diagnostics.AddError("Resource Import Invalid ID", fmt.Sprintf(`Unexpected format for import ID (%s), use: "DomainIdentifier,Id,EnvironmentBlueprint,Id,ProjectIdentifier"`, req.ID)) } resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("domain_identifier"), parts[0])...) diff --git a/internal/service/datazone/environment_profile_test.go b/internal/service/datazone/environment_profile_test.go index 7f6b0501f33..25cd1adc089 100644 --- a/internal/service/datazone/environment_profile_test.go +++ b/internal/service/datazone/environment_profile_test.go @@ -67,10 +67,10 @@ func TestAccDataZoneEnvironmentProfile_basic(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - ImportStateIdFunc: testAccAuthorizerEnvProfImportStateIdFunc(resourceName), + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateIdFunc: testAccAuthorizerEnvProfImportStateIdFunc(resourceName), }, }, }) @@ -123,11 +123,10 @@ func TestAccDataZoneEnvironmentProfile_update(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - ImportStateIdFunc: testAccAuthorizerEnvProfImportStateIdFunc(resourceName), - ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateIdFunc: testAccAuthorizerEnvProfImportStateIdFunc(resourceName), }, { Config: testAccEnvironmentProfileConfig_update(epName, dName, pName), @@ -150,11 +149,10 @@ func TestAccDataZoneEnvironmentProfile_update(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - ImportStateIdFunc: testAccAuthorizerEnvProfImportStateIdFunc(resourceName), - ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateIdFunc: testAccAuthorizerEnvProfImportStateIdFunc(resourceName), }, }, }) @@ -251,7 +249,7 @@ func testAccAuthorizerEnvProfImportStateIdFunc(resourceName string) resource.Imp return "", fmt.Errorf("Not found: %s", resourceName) } - return strings.Join([]string{rs.Primary.Attributes["domain_identifier"], rs.Primary.ID, rs.Primary.Attributes["environment_blueprint_identifier"], rs.Primary.Attributes["project_identifier"]}, ","), nil + return strings.Join([]string{rs.Primary.Attributes["domain_identifier"], rs.Primary.ID}, ","), nil } } diff --git a/internal/service/datazone/service_package_gen.go b/internal/service/datazone/service_package_gen.go index 1d291a03f22..b7f374cebe3 100644 --- a/internal/service/datazone/service_package_gen.go +++ b/internal/service/datazone/service_package_gen.go @@ -36,11 +36,11 @@ func (p *servicePackage) FrameworkResources(ctx context.Context) []*types.Servic Factory: newResourceEnvironmentBlueprintConfiguration, Name: "Environment Blueprint Configuration", }, - { + { Factory: newResourceEnvironmentProfile, Name: "Environment Profile", }, - { + { Factory: newResourceGlossary, Name: "Glossary", }, diff --git a/website/docs/r/datazone_environment_profile.html.markdown b/website/docs/r/datazone_environment_profile.html.markdown index ec8e0803bbc..21beca9e1b2 100644 --- a/website/docs/r/datazone_environment_profile.html.markdown +++ b/website/docs/r/datazone_environment_profile.html.markdown @@ -109,16 +109,16 @@ resource "aws_datazone_environment_profile" "test" { The following arguments are required: -* `aws_account_id` - (Required) - Id of the AWS account being used. Must follow regex of ^\d{12}$. -* `aws_account_region` - (Required) - Desired region for environment profile. Must follow regex of ^[a-z]{2}-[a-z]{4,10}-\d$. +* `aws_account_id` - (Required) - Id of the AWS account being used. +* `aws_account_region` - (Required) - Desired region for environment profile. * `domain_identifier` - (Required) - Domain Identifier for environment profile. -* `name` - (Required) - Name of the environment profile. Must follow regex of ^[\w -]+$ and have the length between 1 and 64. -* `environment_blueprint_identifier` - (Required) - ID of the blueprint which the environment will be created with. Must follow regex of ^[a-zA-Z0-9_-]{1,36}$. -* `project_identifier` - (Required) - Project identifier for environment profile. Must follow regex of ^[a-zA-Z0-9_-]{1,36}$. +* `name` - (Required) - Name of the environment profile. +* `environment_blueprint_identifier` - (Required) - ID of the blueprint which the environment will be created with. +* `project_identifier` - (Required) - Project identifier for environment profile. The following arguments are optional: -* `description` - (Optional) Description of environment profile. Must be between the length of 0 and 2048. +* `description` - (Optional) Description of environment profile. * `user_parameters` - (Optional) - Array of user parameters of the environment profile with the following attributes: * `name` - (Required) - Name of the environment profile parameter. * `value` - (Required) - Value of the environment profile parameter.