Skip to content

Commit

Permalink
Formatting + fixing pr issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasZalewski committed Aug 6, 2024
1 parent 707c94e commit cbbe0fc
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 26 deletions.
6 changes: 3 additions & 3 deletions internal/service/datazone/environment_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)...)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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])...)
Expand Down
28 changes: 13 additions & 15 deletions internal/service/datazone/environment_profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
},
},
})
Expand Down Expand Up @@ -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),
Expand All @@ -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),
},
},
})
Expand Down Expand Up @@ -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
}
}

Expand Down
4 changes: 2 additions & 2 deletions internal/service/datazone/service_package_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions website/docs/r/datazone_environment_profile.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit cbbe0fc

Please sign in to comment.