diff --git a/.ci/.semgrep-constants.yml b/.ci/.semgrep-constants.yml index f2ac36e7e5c..db99748be51 100644 --- a/.ci/.semgrep-constants.yml +++ b/.ci/.semgrep-constants.yml @@ -29,6 +29,20 @@ rules: severity: ERROR fix: "names.AttrARNs" + - id: literal-aws_account_id-string-constant + languages: [go] + message: Use the constant `names.AttrAWSAccountID` for the string literal "aws_account_id" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"aws_account_id"' + - pattern-not-regex: '"aws_account_id":\s+test\w+,' + - pattern-not-inside: | + config.Variables{ ... } + severity: ERROR + fix: "names.AttrAWSAccountID" + - id: literal-access_key-string-constant languages: [go] message: Use the constant `names.AttrAccessKey` for the string literal "access_key" @@ -99,6 +113,20 @@ rules: severity: ERROR fix: "names.AttrAlias" + - id: literal-application_id-string-constant + languages: [go] + message: Use the constant `names.AttrApplicationID` for the string literal "application_id" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"application_id"' + - pattern-not-regex: '"application_id":\s+test\w+,' + - pattern-not-inside: | + config.Variables{ ... } + severity: ERROR + fix: "names.AttrApplicationID" + - id: literal-apply_immediately-string-constant languages: [go] message: Use the constant `names.AttrApplyImmediately` for the string literal "apply_immediately" @@ -771,6 +799,20 @@ rules: severity: ERROR fix: "names.AttrEndpoints" + - id: literal-engine-string-constant + languages: [go] + message: Use the constant `names.AttrEngine` for the string literal "engine" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"engine"' + - pattern-not-regex: '"engine":\s+test\w+,' + - pattern-not-inside: | + config.Variables{ ... } + severity: ERROR + fix: "names.AttrEngine" + - id: literal-engine_version-string-constant languages: [go] message: Use the constant `names.AttrEngineVersion` for the string literal "engine_version" @@ -813,6 +855,20 @@ rules: severity: ERROR fix: "names.AttrExecutionRoleARN" + - id: literal-expected_bucket_owner-string-constant + languages: [go] + message: Use the constant `names.AttrExpectedBucketOwner` for the string literal "expected_bucket_owner" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"expected_bucket_owner"' + - pattern-not-regex: '"expected_bucket_owner":\s+test\w+,' + - pattern-not-inside: | + config.Variables{ ... } + severity: ERROR + fix: "names.AttrExpectedBucketOwner" + - id: literal-expression-string-constant languages: [go] message: Use the constant `names.AttrExpression` for the string literal "expression" @@ -1093,6 +1149,20 @@ rules: severity: ERROR fix: "names.AttrIPAddressType" + - id: literal-ip_addresses-string-constant + languages: [go] + message: Use the constant `names.AttrIPAddresses` for the string literal "ip_addresses" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"ip_addresses"' + - pattern-not-regex: '"ip_addresses":\s+test\w+,' + - pattern-not-inside: | + config.Variables{ ... } + severity: ERROR + fix: "names.AttrIPAddresses" + - id: literal-identifier-string-constant languages: [go] message: Use the constant `names.AttrIdentifier` for the string literal "identifier" @@ -1527,6 +1597,20 @@ rules: severity: ERROR fix: "names.AttrOwner" + - id: literal-owner_account_id-string-constant + languages: [go] + message: Use the constant `names.AttrOwnerAccountID` for the string literal "owner_account_id" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"owner_account_id"' + - pattern-not-regex: '"owner_account_id":\s+test\w+,' + - pattern-not-inside: | + config.Variables{ ... } + severity: ERROR + fix: "names.AttrOwnerAccountID" + - id: literal-owner_id-string-constant languages: [go] message: Use the constant `names.AttrOwnerID` for the string literal "owner_id" @@ -1555,6 +1639,20 @@ rules: severity: ERROR fix: "names.AttrParameter" + - id: literal-parameter_group_name-string-constant + languages: [go] + message: Use the constant `names.AttrParameterGroupName` for the string literal "parameter_group_name" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"parameter_group_name"' + - pattern-not-regex: '"parameter_group_name":\s+test\w+,' + - pattern-not-inside: | + config.Variables{ ... } + severity: ERROR + fix: "names.AttrParameterGroupName" + - id: literal-parameters-string-constant languages: [go] message: Use the constant `names.AttrParameters` for the string literal "parameters" @@ -1863,6 +1961,20 @@ rules: severity: ERROR fix: "names.AttrResourceID" + - id: literal-resource_owner-string-constant + languages: [go] + message: Use the constant `names.AttrResourceOwner` for the string literal "resource_owner" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"resource_owner"' + - pattern-not-regex: '"resource_owner":\s+test\w+,' + - pattern-not-inside: | + config.Variables{ ... } + severity: ERROR + fix: "names.AttrResourceOwner" + - id: literal-resource_tags-string-constant languages: [go] message: Use the constant `names.AttrResourceTags` for the string literal "resource_tags" @@ -2381,6 +2493,20 @@ rules: severity: ERROR fix: "names.AttrStatusReason" + - id: literal-storage_encrypted-string-constant + languages: [go] + message: Use the constant `names.AttrStorageEncrypted` for the string literal "storage_encrypted" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"storage_encrypted"' + - pattern-not-regex: '"storage_encrypted":\s+test\w+,' + - pattern-not-inside: | + config.Variables{ ... } + severity: ERROR + fix: "names.AttrStorageEncrypted" + - id: literal-storage_type-string-constant languages: [go] message: Use the constant `names.AttrStorageType` for the string literal "storage_type" @@ -2521,6 +2647,20 @@ rules: severity: ERROR fix: "names.AttrTargetARN" + - id: literal-throughput-string-constant + languages: [go] + message: Use the constant `names.AttrThroughput` for the string literal "throughput" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"throughput"' + - pattern-not-regex: '"throughput":\s+test\w+,' + - pattern-not-inside: | + config.Variables{ ... } + severity: ERROR + fix: "names.AttrThroughput" + - id: literal-timeout-string-constant languages: [go] message: Use the constant `names.AttrTimeout` for the string literal "timeout" diff --git a/internal/service/appconfig/configuration_profile.go b/internal/service/appconfig/configuration_profile.go index 086a0d67aff..1c63f8a198e 100644 --- a/internal/service/appconfig/configuration_profile.go +++ b/internal/service/appconfig/configuration_profile.go @@ -39,7 +39,7 @@ func ResourceConfigurationProfile() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "application_id": { + names.AttrApplicationID: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -123,7 +123,7 @@ func resourceConfigurationProfileCreate(ctx context.Context, d *schema.ResourceD var diags diag.Diagnostics conn := meta.(*conns.AWSClient).AppConfigClient(ctx) - appId := d.Get("application_id").(string) + appId := d.Get(names.AttrApplicationID).(string) name := d.Get(names.AttrName).(string) input := &appconfig.CreateConfigurationProfileInput{ ApplicationId: aws.String(appId), @@ -198,7 +198,7 @@ func resourceConfigurationProfileRead(ctx context.Context, d *schema.ResourceDat return sdkdiag.AppendErrorf(diags, "reading AppConfig Configuration Profile (%s) for Application (%s): empty response", confProfID, appID) } - d.Set("application_id", output.ApplicationId) + d.Set(names.AttrApplicationID, output.ApplicationId) d.Set("configuration_profile_id", output.Id) d.Set(names.AttrDescription, output.Description) d.Set("kms_key_identifier", output.KmsKeyIdentifier) diff --git a/internal/service/appconfig/configuration_profile_data_source.go b/internal/service/appconfig/configuration_profile_data_source.go index 9b79b682f4b..e3ad9ffcc34 100644 --- a/internal/service/appconfig/configuration_profile_data_source.go +++ b/internal/service/appconfig/configuration_profile_data_source.go @@ -25,7 +25,7 @@ func DataSourceConfigurationProfile() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceConfigurationProfileRead, Schema: map[string]*schema.Schema{ - "application_id": { + names.AttrApplicationID: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringMatch(regexache.MustCompile(`[a-z\d]{4,7}`), ""), @@ -93,7 +93,7 @@ func dataSourceConfigurationProfileRead(ctx context.Context, d *schema.ResourceD conn := meta.(*conns.AWSClient).AppConfigClient(ctx) - appId := d.Get("application_id").(string) + appId := d.Get(names.AttrApplicationID).(string) profileId := d.Get("configuration_profile_id").(string) ID := fmt.Sprintf("%s:%s", profileId, appId) @@ -104,7 +104,7 @@ func dataSourceConfigurationProfileRead(ctx context.Context, d *schema.ResourceD d.SetId(ID) - d.Set("application_id", appId) + d.Set(names.AttrApplicationID, appId) arn := arn.ARN{ AccountID: meta.(*conns.AWSClient).AccountID, diff --git a/internal/service/appconfig/configuration_profile_data_source_test.go b/internal/service/appconfig/configuration_profile_data_source_test.go index 48b0df0d3a6..449d0cfdb28 100644 --- a/internal/service/appconfig/configuration_profile_data_source_test.go +++ b/internal/service/appconfig/configuration_profile_data_source_test.go @@ -34,7 +34,7 @@ func TestAccAppConfigConfigurationProfileDataSource_basic(t *testing.T) { { Config: testAccConfigurationProfileDataSourceConfig_basic(appName, rName), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrPair(dataSourceName, "application_id", appResourceName, names.AttrID), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrApplicationID, appResourceName, names.AttrID), acctest.MatchResourceAttrRegionalARN(dataSourceName, names.AttrARN, "appconfig", regexache.MustCompile(`application/([a-z\d]{4,7})/configurationprofile/+.`)), resource.TestMatchResourceAttr(dataSourceName, "configuration_profile_id", regexache.MustCompile(`[a-z\d]{4,7}`)), resource.TestCheckResourceAttr(dataSourceName, "kms_key_identifier", "alias/"+rName), diff --git a/internal/service/appconfig/configuration_profile_test.go b/internal/service/appconfig/configuration_profile_test.go index 2e8de9be0b6..5b846f2efe5 100644 --- a/internal/service/appconfig/configuration_profile_test.go +++ b/internal/service/appconfig/configuration_profile_test.go @@ -38,7 +38,7 @@ func TestAccAppConfigConfigurationProfile_basic(t *testing.T) { Config: testAccConfigurationProfileConfig_name(rName), Check: resource.ComposeTestCheckFunc( testAccCheckConfigurationProfileExists(ctx, resourceName), - resource.TestCheckResourceAttrPair(resourceName, "application_id", appResourceName, names.AttrID), + resource.TestCheckResourceAttrPair(resourceName, names.AttrApplicationID, appResourceName, names.AttrID), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "appconfig", regexache.MustCompile(`application/[0-9a-z]{4,7}/configurationprofile/[0-9a-z]{4,7}`)), resource.TestMatchResourceAttr(resourceName, "configuration_profile_id", regexache.MustCompile(`[0-9a-z]{4,7}`)), resource.TestCheckResourceAttr(resourceName, "location_uri", "hosted"), diff --git a/internal/service/appconfig/configuration_profiles_data_source.go b/internal/service/appconfig/configuration_profiles_data_source.go index 8b5c10d8263..25f1540881a 100644 --- a/internal/service/appconfig/configuration_profiles_data_source.go +++ b/internal/service/appconfig/configuration_profiles_data_source.go @@ -21,7 +21,7 @@ func DataSourceConfigurationProfiles() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceConfigurationProfilesRead, Schema: map[string]*schema.Schema{ - "application_id": { + names.AttrApplicationID: { Type: schema.TypeString, Required: true, }, @@ -42,7 +42,7 @@ func dataSourceConfigurationProfilesRead(ctx context.Context, d *schema.Resource var diags diag.Diagnostics conn := meta.(*conns.AWSClient).AppConfigClient(ctx) - appId := d.Get("application_id").(string) + appId := d.Get(names.AttrApplicationID).(string) out, err := findConfigurationProfileSummariesByApplication(ctx, conn, appId) if err != nil { diff --git a/internal/service/appconfig/deployment.go b/internal/service/appconfig/deployment.go index c2928d4bcff..39876968a0d 100644 --- a/internal/service/appconfig/deployment.go +++ b/internal/service/appconfig/deployment.go @@ -41,7 +41,7 @@ func ResourceDeployment() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "application_id": { + names.AttrApplicationID: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -113,7 +113,7 @@ func resourceDeploymentCreate(ctx context.Context, d *schema.ResourceData, meta conn := meta.(*conns.AWSClient).AppConfigClient(ctx) input := &appconfig.StartDeploymentInput{ - ApplicationId: aws.String(d.Get("application_id").(string)), + ApplicationId: aws.String(d.Get(names.AttrApplicationID).(string)), EnvironmentId: aws.String(d.Get("environment_id").(string)), ConfigurationProfileId: aws.String(d.Get("configuration_profile_id").(string)), ConfigurationVersion: aws.String(d.Get("configuration_version").(string)), @@ -186,7 +186,7 @@ func resourceDeploymentRead(ctx context.Context, d *schema.ResourceData, meta in Service: "appconfig", }.String() - d.Set("application_id", output.ApplicationId) + d.Set(names.AttrApplicationID, output.ApplicationId) d.Set(names.AttrARN, arn) d.Set("configuration_profile_id", output.ConfigurationProfileId) d.Set("configuration_version", output.ConfigurationVersion) diff --git a/internal/service/appconfig/deployment_test.go b/internal/service/appconfig/deployment_test.go index 693be8fc01a..567139eb7cf 100644 --- a/internal/service/appconfig/deployment_test.go +++ b/internal/service/appconfig/deployment_test.go @@ -41,7 +41,7 @@ func TestAccAppConfigDeployment_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckDeploymentExists(ctx, resourceName), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "appconfig", regexache.MustCompile(`application/[0-9a-z]{4,7}/environment/[0-9a-z]{4,7}/deployment/1`)), - resource.TestCheckResourceAttrPair(resourceName, "application_id", appResourceName, names.AttrID), + resource.TestCheckResourceAttrPair(resourceName, names.AttrApplicationID, appResourceName, names.AttrID), resource.TestCheckResourceAttrPair(resourceName, "configuration_profile_id", confProfResourceName, "configuration_profile_id"), resource.TestCheckResourceAttrPair(resourceName, "configuration_version", confVersionResourceName, "version_number"), resource.TestCheckResourceAttr(resourceName, "deployment_number", acctest.Ct1), @@ -82,7 +82,7 @@ func TestAccAppConfigDeployment_kms(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckDeploymentExists(ctx, resourceName), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "appconfig", regexache.MustCompile(`application/[0-9a-z]{4,7}/environment/[0-9a-z]{4,7}/deployment/1`)), - resource.TestCheckResourceAttrPair(resourceName, "application_id", appResourceName, names.AttrID), + resource.TestCheckResourceAttrPair(resourceName, names.AttrApplicationID, appResourceName, names.AttrID), resource.TestCheckResourceAttrPair(resourceName, "configuration_profile_id", confProfResourceName, "configuration_profile_id"), resource.TestCheckResourceAttrPair(resourceName, "configuration_version", confVersionResourceName, "version_number"), resource.TestCheckResourceAttr(resourceName, "deployment_number", acctest.Ct1), diff --git a/internal/service/appconfig/environment.go b/internal/service/appconfig/environment.go index a6bf0eb8234..eae43673494 100644 --- a/internal/service/appconfig/environment.go +++ b/internal/service/appconfig/environment.go @@ -55,7 +55,7 @@ func (r *resourceEnvironment) Metadata(_ context.Context, request resource.Metad func (r *resourceEnvironment) Schema(ctx context.Context, request resource.SchemaRequest, response *resource.SchemaResponse) { s := schema.Schema{ Attributes: map[string]schema.Attribute{ - "application_id": schema.StringAttribute{ + names.AttrApplicationID: schema.StringAttribute{ Required: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.RequiresReplace(), @@ -282,8 +282,8 @@ func (r *resourceEnvironment) Delete(ctx context.Context, request resource.Delet } tflog.Debug(ctx, "Deleting AppConfig Environment", map[string]any{ - "application_id": state.ApplicationID.ValueString(), - "environment_id": state.EnvironmentID.ValueString(), + names.AttrApplicationID: state.ApplicationID.ValueString(), + "environment_id": state.EnvironmentID.ValueString(), }) _, err := conn.DeleteEnvironment(ctx, state.deleteEnvironmentInput()) @@ -306,7 +306,7 @@ func (r *resourceEnvironment) ImportState(ctx context.Context, request resource. } response.Diagnostics.Append(response.State.SetAttribute(ctx, path.Root("environment_id"), parts[0])...) - response.Diagnostics.Append(response.State.SetAttribute(ctx, path.Root("application_id"), parts[1])...) + response.Diagnostics.Append(response.State.SetAttribute(ctx, path.Root(names.AttrApplicationID), parts[1])...) } func (r *resourceEnvironment) ModifyPlan(ctx context.Context, request resource.ModifyPlanRequest, response *resource.ModifyPlanResponse) { diff --git a/internal/service/appconfig/environment_data_source.go b/internal/service/appconfig/environment_data_source.go index aadcbbb2ee3..dbda13c19fe 100644 --- a/internal/service/appconfig/environment_data_source.go +++ b/internal/service/appconfig/environment_data_source.go @@ -25,7 +25,7 @@ func DataSourceEnvironment() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceEnvironmentRead, Schema: map[string]*schema.Schema{ - "application_id": { + names.AttrApplicationID: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringMatch(regexache.MustCompile(`[a-z\d]{4,7}`), ""), @@ -81,7 +81,7 @@ func dataSourceEnvironmentRead(ctx context.Context, d *schema.ResourceData, meta conn := meta.(*conns.AWSClient).AppConfigClient(ctx) - appID := d.Get("application_id").(string) + appID := d.Get(names.AttrApplicationID).(string) envID := d.Get("environment_id").(string) ID := fmt.Sprintf("%s:%s", envID, appID) @@ -92,7 +92,7 @@ func dataSourceEnvironmentRead(ctx context.Context, d *schema.ResourceData, meta d.SetId(ID) - d.Set("application_id", appID) + d.Set(names.AttrApplicationID, appID) d.Set("environment_id", envID) d.Set(names.AttrDescription, out.Description) d.Set(names.AttrName, out.Name) diff --git a/internal/service/appconfig/environment_data_source_test.go b/internal/service/appconfig/environment_data_source_test.go index 79b97ccd4a9..7da36b774fd 100644 --- a/internal/service/appconfig/environment_data_source_test.go +++ b/internal/service/appconfig/environment_data_source_test.go @@ -34,7 +34,7 @@ func TestAccAppConfigEnvironmentDataSource_basic(t *testing.T) { Config: testAccEnvironmentDataSourceConfig_basic(appName, rName), Check: resource.ComposeTestCheckFunc( acctest.MatchResourceAttrRegionalARN(dataSourceName, names.AttrARN, "appconfig", regexache.MustCompile(`application/([a-z\d]{4,7})/environment/+.`)), - resource.TestCheckResourceAttrPair(dataSourceName, "application_id", appResourceName, names.AttrID), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrApplicationID, appResourceName, names.AttrID), resource.TestCheckResourceAttr(dataSourceName, names.AttrDescription, "Example AppConfig Environment"), resource.TestMatchResourceAttr(dataSourceName, "environment_id", regexache.MustCompile(`[a-z\d]{4,7}`)), resource.TestCheckResourceAttr(dataSourceName, "monitor.#", acctest.Ct1), diff --git a/internal/service/appconfig/environment_test.go b/internal/service/appconfig/environment_test.go index 7dc6d123872..191540f1a33 100644 --- a/internal/service/appconfig/environment_test.go +++ b/internal/service/appconfig/environment_test.go @@ -39,7 +39,7 @@ func TestAccAppConfigEnvironment_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckEnvironmentExists(ctx, resourceName), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "appconfig", regexache.MustCompile(`application/[0-9a-z]{4,7}/environment/[0-9a-z]{4,7}`)), - resource.TestCheckResourceAttrPair(resourceName, "application_id", appResourceName, names.AttrID), + resource.TestCheckResourceAttrPair(resourceName, names.AttrApplicationID, appResourceName, names.AttrID), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, ""), resource.TestCheckResourceAttr(resourceName, "monitor.#", acctest.Ct0), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), @@ -408,7 +408,7 @@ func testAccCheckEnvironmentDestroy(ctx context.Context) resource.TestCheckFunc continue } - appID := rs.Primary.Attributes["application_id"] + appID := rs.Primary.Attributes[names.AttrApplicationID] envID := rs.Primary.Attributes["environment_id"] input := &appconfig.GetEnvironmentInput{ @@ -446,7 +446,7 @@ func testAccCheckEnvironmentExists(ctx context.Context, resourceName string) res return fmt.Errorf("Resource (%s) ID not set", resourceName) } - appID := rs.Primary.Attributes["application_id"] + appID := rs.Primary.Attributes[names.AttrApplicationID] envID := rs.Primary.Attributes["environment_id"] conn := acctest.Provider.Meta().(*conns.AWSClient).AppConfigClient(ctx) diff --git a/internal/service/appconfig/environments_data_source.go b/internal/service/appconfig/environments_data_source.go index 5eddc29fba9..a6b8e5f898e 100644 --- a/internal/service/appconfig/environments_data_source.go +++ b/internal/service/appconfig/environments_data_source.go @@ -23,7 +23,7 @@ func DataSourceEnvironments() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceEnvironmentsRead, Schema: map[string]*schema.Schema{ - "application_id": { + names.AttrApplicationID: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringMatch(regexache.MustCompile(`[a-z\d]{4,7}`), ""), @@ -45,7 +45,7 @@ func dataSourceEnvironmentsRead(ctx context.Context, d *schema.ResourceData, met var diags diag.Diagnostics conn := meta.(*conns.AWSClient).AppConfigClient(ctx) - appID := d.Get("application_id").(string) + appID := d.Get(names.AttrApplicationID).(string) out, err := findEnvironmentsByApplication(ctx, conn, appID) if err != nil { diff --git a/internal/service/appconfig/hosted_configuration_version.go b/internal/service/appconfig/hosted_configuration_version.go index 5d991be7840..129115c2950 100644 --- a/internal/service/appconfig/hosted_configuration_version.go +++ b/internal/service/appconfig/hosted_configuration_version.go @@ -35,7 +35,7 @@ func ResourceHostedConfigurationVersion() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "application_id": { + names.AttrApplicationID: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -81,7 +81,7 @@ func resourceHostedConfigurationVersionCreate(ctx context.Context, d *schema.Res var diags diag.Diagnostics conn := meta.(*conns.AWSClient).AppConfigClient(ctx) - appID := d.Get("application_id").(string) + appID := d.Get(names.AttrApplicationID).(string) profileID := d.Get("configuration_profile_id").(string) input := &appconfig.CreateHostedConfigurationVersionInput{ @@ -138,7 +138,7 @@ func resourceHostedConfigurationVersionRead(ctx context.Context, d *schema.Resou return sdkdiag.AppendErrorf(diags, "reading AppConfig Hosted Configuration Version (%s): empty response", d.Id()) } - d.Set("application_id", output.ApplicationId) + d.Set(names.AttrApplicationID, output.ApplicationId) d.Set("configuration_profile_id", output.ConfigurationProfileId) d.Set(names.AttrContent, string(output.Content)) d.Set(names.AttrContentType, output.ContentType) diff --git a/internal/service/appconfig/hosted_configuration_version_test.go b/internal/service/appconfig/hosted_configuration_version_test.go index 2b12d7c333f..0cbfd3475cf 100644 --- a/internal/service/appconfig/hosted_configuration_version_test.go +++ b/internal/service/appconfig/hosted_configuration_version_test.go @@ -38,7 +38,7 @@ func TestAccAppConfigHostedConfigurationVersion_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckHostedConfigurationVersionExists(ctx, resourceName), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "appconfig", regexache.MustCompile(`application/[0-9a-z]{4,7}/configurationprofile/[0-9a-z]{4,7}/hostedconfigurationversion/[0-9]+`)), - resource.TestCheckResourceAttrPair(resourceName, "application_id", "aws_appconfig_application.test", names.AttrID), + resource.TestCheckResourceAttrPair(resourceName, names.AttrApplicationID, "aws_appconfig_application.test", names.AttrID), resource.TestCheckResourceAttrPair(resourceName, "configuration_profile_id", "aws_appconfig_configuration_profile.test", "configuration_profile_id"), resource.TestCheckResourceAttr(resourceName, names.AttrContent, "{\"foo\":\"bar\"}"), resource.TestCheckResourceAttr(resourceName, names.AttrContentType, "application/json"), diff --git a/internal/service/appconfig/sweep.go b/internal/service/appconfig/sweep.go index 9d9728daf85..cf5e3c467cf 100644 --- a/internal/service/appconfig/sweep.go +++ b/internal/service/appconfig/sweep.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/sweep" "github.com/hashicorp/terraform-provider-aws/internal/sweep/awsv2" "github.com/hashicorp/terraform-provider-aws/internal/sweep/framework" + "github.com/hashicorp/terraform-provider-aws/names" ) func RegisterSweepers() { @@ -263,7 +264,7 @@ func sweepEnvironments(region string) error { for _, v := range page.Items { sweepResources = append(sweepResources, framework.NewSweepResource(newResourceEnvironment, client, - framework.NewAttribute("application_id", aws.ToString(v.ApplicationId)), + framework.NewAttribute(names.AttrApplicationID, aws.ToString(v.ApplicationId)), framework.NewAttribute("environment_id", aws.ToString(v.Id)), )) } diff --git a/internal/service/appmesh/gateway_route.go b/internal/service/appmesh/gateway_route.go index 9b3e5131b36..ca0c388320f 100644 --- a/internal/service/appmesh/gateway_route.go +++ b/internal/service/appmesh/gateway_route.go @@ -72,7 +72,7 @@ func resourceGatewayRoute() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 255), }, - "resource_owner": { + names.AttrResourceOwner: { Type: schema.TypeString, Computed: true, }, @@ -560,7 +560,7 @@ func resourceGatewayRouteRead(ctx context.Context, d *schema.ResourceData, meta d.Set("mesh_name", gatewayRoute.MeshName) d.Set("mesh_owner", gatewayRoute.Metadata.MeshOwner) d.Set(names.AttrName, gatewayRoute.GatewayRouteName) - d.Set("resource_owner", gatewayRoute.Metadata.ResourceOwner) + d.Set(names.AttrResourceOwner, gatewayRoute.Metadata.ResourceOwner) if err := d.Set("spec", flattenGatewayRouteSpec(gatewayRoute.Spec)); err != nil { return sdkdiag.AppendErrorf(diags, "setting spec: %s", err) } diff --git a/internal/service/appmesh/gateway_route_data_source.go b/internal/service/appmesh/gateway_route_data_source.go index 6305ec7782c..197a542c7e4 100644 --- a/internal/service/appmesh/gateway_route_data_source.go +++ b/internal/service/appmesh/gateway_route_data_source.go @@ -49,7 +49,7 @@ func dataSourceGatewayRoute() *schema.Resource { Type: schema.TypeString, Required: true, }, - "resource_owner": { + names.AttrResourceOwner: { Type: schema.TypeString, Computed: true, }, @@ -85,7 +85,7 @@ func dataSourceGatewayRouteRead(ctx context.Context, d *schema.ResourceData, met meshOwner := aws.StringValue(gatewayRoute.Metadata.MeshOwner) d.Set("mesh_owner", meshOwner) d.Set(names.AttrName, gatewayRoute.GatewayRouteName) - d.Set("resource_owner", gatewayRoute.Metadata.ResourceOwner) + d.Set(names.AttrResourceOwner, gatewayRoute.Metadata.ResourceOwner) if err := d.Set("spec", flattenGatewayRouteSpec(gatewayRoute.Spec)); err != nil { return sdkdiag.AppendErrorf(diags, "setting spec: %s", err) } diff --git a/internal/service/appmesh/mesh.go b/internal/service/appmesh/mesh.go index 0b5900b4318..fb1ba70d898 100644 --- a/internal/service/appmesh/mesh.go +++ b/internal/service/appmesh/mesh.go @@ -60,7 +60,7 @@ func resourceMesh() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 255), }, - "resource_owner": { + names.AttrResourceOwner: { Type: schema.TypeString, Computed: true, }, @@ -166,7 +166,7 @@ func resourceMeshRead(ctx context.Context, d *schema.ResourceData, meta interfac d.Set(names.AttrLastUpdatedDate, mesh.Metadata.LastUpdatedAt.Format(time.RFC3339)) d.Set("mesh_owner", mesh.Metadata.MeshOwner) d.Set(names.AttrName, mesh.MeshName) - d.Set("resource_owner", mesh.Metadata.ResourceOwner) + d.Set(names.AttrResourceOwner, mesh.Metadata.ResourceOwner) if err := d.Set("spec", flattenMeshSpec(mesh.Spec)); err != nil { return sdkdiag.AppendErrorf(diags, "setting spec: %s", err) } diff --git a/internal/service/appmesh/mesh_data_source.go b/internal/service/appmesh/mesh_data_source.go index bf178a4bb05..e4b55708a22 100644 --- a/internal/service/appmesh/mesh_data_source.go +++ b/internal/service/appmesh/mesh_data_source.go @@ -45,7 +45,7 @@ func dataSourceMesh() *schema.Resource { Type: schema.TypeString, Required: true, }, - "resource_owner": { + names.AttrResourceOwner: { Type: schema.TypeString, Computed: true, }, @@ -75,7 +75,7 @@ func dataSourceMeshRead(ctx context.Context, d *schema.ResourceData, meta interf d.Set(names.AttrLastUpdatedDate, mesh.Metadata.LastUpdatedAt.Format(time.RFC3339)) meshOwner := aws.StringValue(mesh.Metadata.MeshOwner) d.Set("mesh_owner", meshOwner) - d.Set("resource_owner", mesh.Metadata.ResourceOwner) + d.Set(names.AttrResourceOwner, mesh.Metadata.ResourceOwner) if err := d.Set("spec", flattenMeshSpec(mesh.Spec)); err != nil { return sdkdiag.AppendErrorf(diags, "setting spec: %s", err) } diff --git a/internal/service/appmesh/route.go b/internal/service/appmesh/route.go index 1d346578d54..8a7c7bceb9b 100644 --- a/internal/service/appmesh/route.go +++ b/internal/service/appmesh/route.go @@ -72,7 +72,7 @@ func resourceRoute() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 255), }, - "resource_owner": { + names.AttrResourceOwner: { Type: schema.TypeString, Computed: true, }, @@ -794,7 +794,7 @@ func resourceRouteRead(ctx context.Context, d *schema.ResourceData, meta interfa d.Set("mesh_name", route.MeshName) d.Set("mesh_owner", route.Metadata.MeshOwner) d.Set(names.AttrName, route.RouteName) - d.Set("resource_owner", route.Metadata.ResourceOwner) + d.Set(names.AttrResourceOwner, route.Metadata.ResourceOwner) if err := d.Set("spec", flattenRouteSpec(route.Spec)); err != nil { return sdkdiag.AppendErrorf(diags, "setting spec: %s", err) } diff --git a/internal/service/appmesh/route_data_source.go b/internal/service/appmesh/route_data_source.go index 855550c4cd5..9b25ea741a5 100644 --- a/internal/service/appmesh/route_data_source.go +++ b/internal/service/appmesh/route_data_source.go @@ -49,7 +49,7 @@ func dataSourceRoute() *schema.Resource { Type: schema.TypeString, Required: true, }, - "resource_owner": { + names.AttrResourceOwner: { Type: schema.TypeString, Computed: true, }, @@ -85,7 +85,7 @@ func dataSourceRouteRead(ctx context.Context, d *schema.ResourceData, meta inter meshOwner := aws.StringValue(route.Metadata.MeshOwner) d.Set("mesh_owner", meshOwner) d.Set(names.AttrName, route.RouteName) - d.Set("resource_owner", route.Metadata.ResourceOwner) + d.Set(names.AttrResourceOwner, route.Metadata.ResourceOwner) if err := d.Set("spec", flattenRouteSpec(route.Spec)); err != nil { return sdkdiag.AppendErrorf(diags, "setting spec: %s", err) } diff --git a/internal/service/appmesh/virtual_gateway.go b/internal/service/appmesh/virtual_gateway.go index fd3656a4408..243e3a7af60 100644 --- a/internal/service/appmesh/virtual_gateway.go +++ b/internal/service/appmesh/virtual_gateway.go @@ -72,7 +72,7 @@ func resourceVirtualGateway() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 255), }, - "resource_owner": { + names.AttrResourceOwner: { Type: schema.TypeString, Computed: true, }, @@ -707,7 +707,7 @@ func resourceVirtualGatewayRead(ctx context.Context, d *schema.ResourceData, met d.Set("mesh_name", virtualGateway.MeshName) d.Set("mesh_owner", virtualGateway.Metadata.MeshOwner) d.Set(names.AttrName, virtualGateway.VirtualGatewayName) - d.Set("resource_owner", virtualGateway.Metadata.ResourceOwner) + d.Set(names.AttrResourceOwner, virtualGateway.Metadata.ResourceOwner) if err := d.Set("spec", flattenVirtualGatewaySpec(virtualGateway.Spec)); err != nil { return sdkdiag.AppendErrorf(diags, "setting spec: %s", err) } diff --git a/internal/service/appmesh/virtual_gateway_data_source.go b/internal/service/appmesh/virtual_gateway_data_source.go index ed01d9febd1..054b882e114 100644 --- a/internal/service/appmesh/virtual_gateway_data_source.go +++ b/internal/service/appmesh/virtual_gateway_data_source.go @@ -48,7 +48,7 @@ func dataSourceVirtualGateway() *schema.Resource { Type: schema.TypeString, Required: true, }, - "resource_owner": { + names.AttrResourceOwner: { Type: schema.TypeString, Computed: true, }, @@ -80,7 +80,7 @@ func dataSourceVirtualGatewayRead(ctx context.Context, d *schema.ResourceData, m meshOwner := aws.StringValue(virtualGateway.Metadata.MeshOwner) d.Set("mesh_owner", meshOwner) d.Set(names.AttrName, virtualGateway.VirtualGatewayName) - d.Set("resource_owner", virtualGateway.Metadata.ResourceOwner) + d.Set(names.AttrResourceOwner, virtualGateway.Metadata.ResourceOwner) if err := d.Set("spec", flattenVirtualGatewaySpec(virtualGateway.Spec)); err != nil { return sdkdiag.AppendErrorf(diags, "setting spec: %s", err) } diff --git a/internal/service/appmesh/virtual_node.go b/internal/service/appmesh/virtual_node.go index d35ac1931ff..5e613cad5c4 100644 --- a/internal/service/appmesh/virtual_node.go +++ b/internal/service/appmesh/virtual_node.go @@ -75,7 +75,7 @@ func resourceVirtualNode() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 255), }, - "resource_owner": { + names.AttrResourceOwner: { Type: schema.TypeString, Computed: true, }, @@ -1024,7 +1024,7 @@ func resourceVirtualNodeRead(ctx context.Context, d *schema.ResourceData, meta i d.Set("mesh_name", vn.MeshName) d.Set("mesh_owner", vn.Metadata.MeshOwner) d.Set(names.AttrName, vn.VirtualNodeName) - d.Set("resource_owner", vn.Metadata.ResourceOwner) + d.Set(names.AttrResourceOwner, vn.Metadata.ResourceOwner) if err := d.Set("spec", flattenVirtualNodeSpec(vn.Spec)); err != nil { return sdkdiag.AppendErrorf(diags, "setting spec: %s", err) } diff --git a/internal/service/appmesh/virtual_node_data_source.go b/internal/service/appmesh/virtual_node_data_source.go index d5c161d0be0..8689b4ea08e 100644 --- a/internal/service/appmesh/virtual_node_data_source.go +++ b/internal/service/appmesh/virtual_node_data_source.go @@ -49,7 +49,7 @@ func dataSourceVirtualNode() *schema.Resource { Type: schema.TypeString, Required: true, }, - "resource_owner": { + names.AttrResourceOwner: { Type: schema.TypeString, Computed: true, }, @@ -81,7 +81,7 @@ func dataSourceVirtualNodeRead(ctx context.Context, d *schema.ResourceData, meta meshOwner := aws.StringValue(vn.Metadata.MeshOwner) d.Set("mesh_owner", meshOwner) d.Set(names.AttrName, vn.VirtualNodeName) - d.Set("resource_owner", vn.Metadata.ResourceOwner) + d.Set(names.AttrResourceOwner, vn.Metadata.ResourceOwner) if err := d.Set("spec", flattenVirtualNodeSpec(vn.Spec)); err != nil { return sdkdiag.AppendErrorf(diags, "setting spec: %s", err) } diff --git a/internal/service/appmesh/virtual_router.go b/internal/service/appmesh/virtual_router.go index c6520f9d197..d063d2297c9 100644 --- a/internal/service/appmesh/virtual_router.go +++ b/internal/service/appmesh/virtual_router.go @@ -75,7 +75,7 @@ func resourceVirtualRouter() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 255), }, - "resource_owner": { + names.AttrResourceOwner: { Type: schema.TypeString, Computed: true, }, @@ -185,7 +185,7 @@ func resourceVirtualRouterRead(ctx context.Context, d *schema.ResourceData, meta d.Set("mesh_name", vr.MeshName) d.Set("mesh_owner", vr.Metadata.MeshOwner) d.Set(names.AttrName, vr.VirtualRouterName) - d.Set("resource_owner", vr.Metadata.ResourceOwner) + d.Set(names.AttrResourceOwner, vr.Metadata.ResourceOwner) if err := d.Set("spec", flattenVirtualRouterSpec(vr.Spec)); err != nil { return sdkdiag.AppendErrorf(diags, "setting spec: %s", err) } diff --git a/internal/service/appmesh/virtual_router_data_source.go b/internal/service/appmesh/virtual_router_data_source.go index bf41977a6e7..9fddf209f3c 100644 --- a/internal/service/appmesh/virtual_router_data_source.go +++ b/internal/service/appmesh/virtual_router_data_source.go @@ -49,7 +49,7 @@ func dataSourceVirtualRouter() *schema.Resource { Type: schema.TypeString, Required: true, }, - "resource_owner": { + names.AttrResourceOwner: { Type: schema.TypeString, Computed: true, }, @@ -81,7 +81,7 @@ func dataSourceVirtualRouterRead(ctx context.Context, d *schema.ResourceData, me meshOwner := aws.StringValue(vr.Metadata.MeshOwner) d.Set("mesh_owner", meshOwner) d.Set(names.AttrName, vr.VirtualRouterName) - d.Set("resource_owner", vr.Metadata.ResourceOwner) + d.Set(names.AttrResourceOwner, vr.Metadata.ResourceOwner) if err := d.Set("spec", flattenVirtualRouterSpec(vr.Spec)); err != nil { return sdkdiag.AppendErrorf(diags, "setting spec: %s", err) } diff --git a/internal/service/appmesh/virtual_service.go b/internal/service/appmesh/virtual_service.go index 7455d8ab8a1..793be238eba 100644 --- a/internal/service/appmesh/virtual_service.go +++ b/internal/service/appmesh/virtual_service.go @@ -71,7 +71,7 @@ func resourceVirtualService() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 255), }, - "resource_owner": { + names.AttrResourceOwner: { Type: schema.TypeString, Computed: true, }, @@ -194,7 +194,7 @@ func resourceVirtualServiceRead(ctx context.Context, d *schema.ResourceData, met d.Set("mesh_name", vs.MeshName) d.Set("mesh_owner", vs.Metadata.MeshOwner) d.Set(names.AttrName, vs.VirtualServiceName) - d.Set("resource_owner", vs.Metadata.ResourceOwner) + d.Set(names.AttrResourceOwner, vs.Metadata.ResourceOwner) if err := d.Set("spec", flattenVirtualServiceSpec(vs.Spec)); err != nil { return sdkdiag.AppendErrorf(diags, "setting spec: %s", err) } diff --git a/internal/service/appmesh/virtual_service_data_source.go b/internal/service/appmesh/virtual_service_data_source.go index a3917cdd4a6..52ab6045ea4 100644 --- a/internal/service/appmesh/virtual_service_data_source.go +++ b/internal/service/appmesh/virtual_service_data_source.go @@ -49,7 +49,7 @@ func dataSourceVirtualService() *schema.Resource { Type: schema.TypeString, Required: true, }, - "resource_owner": { + names.AttrResourceOwner: { Type: schema.TypeString, Computed: true, }, @@ -81,7 +81,7 @@ func dataSourceVirtualServiceRead(ctx context.Context, d *schema.ResourceData, m meshOwner := aws.StringValue(vs.Metadata.MeshOwner) d.Set("mesh_owner", meshOwner) d.Set(names.AttrName, vs.VirtualServiceName) - d.Set("resource_owner", vs.Metadata.ResourceOwner) + d.Set(names.AttrResourceOwner, vs.Metadata.ResourceOwner) if err := d.Set("spec", flattenVirtualServiceSpec(vs.Spec)); err != nil { return sdkdiag.AppendErrorf(diags, "setting spec: %s", err) } diff --git a/internal/service/athena/database.go b/internal/service/athena/database.go index c92185cd8c1..22c3c189694 100644 --- a/internal/service/athena/database.go +++ b/internal/service/athena/database.go @@ -86,7 +86,7 @@ func resourceDatabase() *schema.Resource { }, }, }, - "expected_bucket_owner": { + names.AttrExpectedBucketOwner: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -242,7 +242,7 @@ func expandResultConfiguration(d *schema.ResourceData) *types.ResultConfiguratio EncryptionConfiguration: expandResultConfigurationEncryptionConfig(d.Get(names.AttrEncryptionConfiguration).([]interface{})), } - if v, ok := d.GetOk("expected_bucket_owner"); ok { + if v, ok := d.GetOk(names.AttrExpectedBucketOwner); ok { resultConfig.ExpectedBucketOwner = aws.String(v.(string)) } diff --git a/internal/service/athena/workgroup.go b/internal/service/athena/workgroup.go index d9e4db1bb9d..adf3d48c4f1 100644 --- a/internal/service/athena/workgroup.go +++ b/internal/service/athena/workgroup.go @@ -132,7 +132,7 @@ func resourceWorkGroup() *schema.Resource { }, }, }, - "expected_bucket_owner": { + names.AttrExpectedBucketOwner: { Type: schema.TypeString, Optional: true, }, @@ -450,7 +450,7 @@ func expandWorkGroupResultConfiguration(l []interface{}) *types.ResultConfigurat resultConfiguration.OutputLocation = aws.String(v) } - if v, ok := m["expected_bucket_owner"].(string); ok && v != "" { + if v, ok := m[names.AttrExpectedBucketOwner].(string); ok && v != "" { resultConfiguration.ExpectedBucketOwner = aws.String(v) } @@ -482,7 +482,7 @@ func expandWorkGroupResultConfigurationUpdates(l []interface{}) *types.ResultCon resultConfigurationUpdates.RemoveOutputLocation = aws.Bool(true) } - if v, ok := m["expected_bucket_owner"].(string); ok && v != "" { + if v, ok := m[names.AttrExpectedBucketOwner].(string); ok && v != "" { resultConfigurationUpdates.ExpectedBucketOwner = aws.String(v) } else { resultConfigurationUpdates.RemoveExpectedBucketOwner = aws.Bool(true) @@ -559,7 +559,7 @@ func flattenWorkGroupResultConfiguration(resultConfiguration *types.ResultConfig } if resultConfiguration.ExpectedBucketOwner != nil { - m["expected_bucket_owner"] = aws.ToString(resultConfiguration.ExpectedBucketOwner) + m[names.AttrExpectedBucketOwner] = aws.ToString(resultConfiguration.ExpectedBucketOwner) } if resultConfiguration.AclConfiguration != nil { diff --git a/internal/service/autoscaling/launch_configuration.go b/internal/service/autoscaling/launch_configuration.go index a5f4e2b0e5a..c1f4bd0e5e7 100644 --- a/internal/service/autoscaling/launch_configuration.go +++ b/internal/service/autoscaling/launch_configuration.go @@ -94,7 +94,7 @@ func resourceLaunchConfiguration() *schema.Resource { Computed: true, ForceNew: true, }, - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Optional: true, Computed: true, @@ -253,7 +253,7 @@ func resourceLaunchConfiguration() *schema.Resource { Computed: true, ForceNew: true, }, - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Optional: true, Computed: true, @@ -562,7 +562,7 @@ func expandBlockDeviceMappingForEBSBlockDevice(tfMap map[string]interface{}) aws apiObject.Ebs.SnapshotId = aws.String(v) } - if v, ok := tfMap["throughput"].(int); ok && v != 0 { + if v, ok := tfMap[names.AttrThroughput].(int); ok && v != 0 { apiObject.Ebs.Throughput = aws.Int32(int32(v)) } @@ -612,7 +612,7 @@ func expandBlockDeviceMappingForRootBlockDevice(tfMap map[string]interface{}) aw apiObject.Ebs.Iops = aws.Int32(int32(v)) } - if v, ok := tfMap["throughput"].(int); ok && v != 0 { + if v, ok := tfMap[names.AttrThroughput].(int); ok && v != 0 { apiObject.Ebs.Throughput = aws.Int32(int32(v)) } @@ -681,7 +681,7 @@ func flattenBlockDeviceMappings(apiObjects []awstypes.BlockDeviceMapping, rootDe } if v := v.Throughput; v != nil { - tfMap["throughput"] = aws.ToInt32(v) + tfMap[names.AttrThroughput] = aws.ToInt32(v) } if v := v.VolumeSize; v != nil { diff --git a/internal/service/autoscaling/launch_configuration_data_source.go b/internal/service/autoscaling/launch_configuration_data_source.go index 224733994c1..cae9a54cd1b 100644 --- a/internal/service/autoscaling/launch_configuration_data_source.go +++ b/internal/service/autoscaling/launch_configuration_data_source.go @@ -56,7 +56,7 @@ func dataSourceLaunchConfiguration() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Computed: true, }, @@ -156,7 +156,7 @@ func dataSourceLaunchConfiguration() *schema.Resource { Type: schema.TypeInt, Computed: true, }, - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Computed: true, }, diff --git a/internal/service/autoscaling/launch_configuration_test.go b/internal/service/autoscaling/launch_configuration_test.go index 1aa7aa345bf..f65f47b3a72 100644 --- a/internal/service/autoscaling/launch_configuration_test.go +++ b/internal/service/autoscaling/launch_configuration_test.go @@ -377,7 +377,7 @@ func TestAccAutoScalingLaunchConfiguration_withGP3(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ names.AttrDeviceName: "/dev/sdb", names.AttrEncrypted: acctest.CtTrue, - "throughput": "150", + names.AttrThroughput: "150", names.AttrVolumeSize: "9", names.AttrVolumeType: "gp3", }), diff --git a/internal/service/cognitoidp/managed_user_pool_client.go b/internal/service/cognitoidp/managed_user_pool_client.go index 79e28fa0ca2..4c9045405c5 100644 --- a/internal/service/cognitoidp/managed_user_pool_client.go +++ b/internal/service/cognitoidp/managed_user_pool_client.go @@ -267,7 +267,7 @@ func (r *managedUserPoolClientResource) Schema(ctx context.Context, request reso Validators: []validator.String{ stringvalidator.ExactlyOneOf( path.MatchRelative().AtParent().AtName("application_arn"), - path.MatchRelative().AtParent().AtName("application_id"), + path.MatchRelative().AtParent().AtName(names.AttrApplicationID), ), stringvalidator.ConflictsWith( path.MatchRelative().AtParent().AtName(names.AttrExternalID), @@ -275,7 +275,7 @@ func (r *managedUserPoolClientResource) Schema(ctx context.Context, request reso ), }, }, - "application_id": schema.StringAttribute{ + names.AttrApplicationID: schema.StringAttribute{ Optional: true, Validators: []validator.String{ stringvalidator.AlsoRequires( diff --git a/internal/service/cognitoidp/user_pool_client.go b/internal/service/cognitoidp/user_pool_client.go index 331a176cd52..6dd5902c794 100644 --- a/internal/service/cognitoidp/user_pool_client.go +++ b/internal/service/cognitoidp/user_pool_client.go @@ -261,7 +261,7 @@ func (r *userPoolClientResource) Schema(ctx context.Context, request resource.Sc Validators: []validator.String{ stringvalidator.ExactlyOneOf( path.MatchRelative().AtParent().AtName("application_arn"), - path.MatchRelative().AtParent().AtName("application_id"), + path.MatchRelative().AtParent().AtName(names.AttrApplicationID), ), stringvalidator.ConflictsWith( path.MatchRelative().AtParent().AtName(names.AttrExternalID), @@ -269,7 +269,7 @@ func (r *userPoolClientResource) Schema(ctx context.Context, request resource.Sc ), }, }, - "application_id": schema.StringAttribute{ + names.AttrApplicationID: schema.StringAttribute{ Optional: true, Validators: []validator.String{ stringvalidator.AlsoRequires( @@ -736,7 +736,7 @@ func flattenAnaylticsConfiguration(ctx context.Context, ac *cognitoidentityprovi attrs := map[string]attr.Value{} attrs["application_arn"] = flex.StringToFrameworkARN(ctx, ac.ApplicationArn) - attrs["application_id"] = flex.StringToFramework(ctx, ac.ApplicationId) + attrs[names.AttrApplicationID] = flex.StringToFramework(ctx, ac.ApplicationId) attrs[names.AttrExternalID] = flex.StringToFramework(ctx, ac.ExternalId) attrs[names.AttrRoleARN] = flex.StringToFrameworkARN(ctx, ac.RoleArn) attrs["user_data_shared"] = flex.BoolToFramework(ctx, ac.UserDataShared) diff --git a/internal/service/cognitoidp/user_pool_client_data_source.go b/internal/service/cognitoidp/user_pool_client_data_source.go index 47e9064bdc0..8e88172c390 100644 --- a/internal/service/cognitoidp/user_pool_client_data_source.go +++ b/internal/service/cognitoidp/user_pool_client_data_source.go @@ -49,7 +49,7 @@ func dataSourceUserPoolClient() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "application_id": { + names.AttrApplicationID: { Type: schema.TypeString, Computed: true, }, @@ -245,7 +245,7 @@ func flattenUserPoolClientAnalyticsConfig(analyticsConfig *cognitoidentityprovid } if analyticsConfig.ApplicationId != nil { - m["application_id"] = aws.StringValue(analyticsConfig.ApplicationId) + m[names.AttrApplicationID] = aws.StringValue(analyticsConfig.ApplicationId) } if analyticsConfig.ApplicationArn != nil { diff --git a/internal/service/cognitoidp/user_pool_domain.go b/internal/service/cognitoidp/user_pool_domain.go index 4fa023423a0..dbc7b5bb856 100644 --- a/internal/service/cognitoidp/user_pool_domain.go +++ b/internal/service/cognitoidp/user_pool_domain.go @@ -37,7 +37,7 @@ func resourceUserPoolDomain() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "aws_account_id": { + names.AttrAWSAccountID: { Type: schema.TypeString, Computed: true, }, @@ -135,7 +135,7 @@ func resourceUserPoolDomainRead(ctx context.Context, d *schema.ResourceData, met return sdkdiag.AppendErrorf(diags, "reading Cognito User Pool Domain (%s): %s", d.Id(), err) } - d.Set("aws_account_id", desc.AWSAccountId) + d.Set(names.AttrAWSAccountID, desc.AWSAccountId) d.Set(names.AttrCertificateARN, "") if desc.CustomDomainConfig != nil { d.Set(names.AttrCertificateARN, desc.CustomDomainConfig.CertificateArn) diff --git a/internal/service/cognitoidp/user_pool_domain_test.go b/internal/service/cognitoidp/user_pool_domain_test.go index 234ac875533..3dbc29a640b 100644 --- a/internal/service/cognitoidp/user_pool_domain_test.go +++ b/internal/service/cognitoidp/user_pool_domain_test.go @@ -36,7 +36,7 @@ func TestAccCognitoIDPUserPoolDomain_basic(t *testing.T) { Config: testAccUserPoolDomainConfig_basic(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckUserPoolDomainExists(ctx, resourceName), - acctest.CheckResourceAttrAccountID(resourceName, "aws_account_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrAWSAccountID), resource.TestCheckResourceAttrSet(resourceName, "cloudfront_distribution"), resource.TestCheckResourceAttrSet(resourceName, "cloudfront_distribution_arn"), resource.TestCheckResourceAttr(resourceName, "cloudfront_distribution_zone_id", "Z2FDTNDATAQYW2"), @@ -99,7 +99,7 @@ func TestAccCognitoIDPUserPoolDomain_custom(t *testing.T) { Config: testAccUserPoolDomainConfig_custom(rootDomain, domain, poolName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckUserPoolDomainExists(ctx, resourceName), - acctest.CheckResourceAttrAccountID(resourceName, "aws_account_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrAWSAccountID), resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificateARN, acmCertificateResourceName, names.AttrARN), resource.TestCheckResourceAttrSet(resourceName, "cloudfront_distribution"), resource.TestCheckResourceAttr(resourceName, "cloudfront_distribution_zone_id", "Z2FDTNDATAQYW2"), diff --git a/internal/service/dax/cluster.go b/internal/service/dax/cluster.go index a8a10f4e328..e81a9d67b57 100644 --- a/internal/service/dax/cluster.go +++ b/internal/service/dax/cluster.go @@ -113,7 +113,7 @@ func ResourceCluster() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "parameter_group_name": { + names.AttrParameterGroupName: { Type: schema.TypeString, Optional: true, Computed: true, @@ -235,7 +235,7 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, meta int input.ClusterEndpointEncryptionType = awstypes.ClusterEndpointEncryptionType(v.(string)) } - if v, ok := d.GetOk("parameter_group_name"); ok { + if v, ok := d.GetOk(names.AttrParameterGroupName); ok { input.ParameterGroupName = aws.String(v.(string)) } @@ -349,7 +349,7 @@ func resourceClusterRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set(names.AttrSecurityGroupIDs, flattenSecurityGroupIDs(c.SecurityGroups)) if c.ParameterGroup != nil { - d.Set("parameter_group_name", c.ParameterGroup.ParameterGroupName) + d.Set(names.AttrParameterGroupName, c.ParameterGroup.ParameterGroupName) } d.Set("maintenance_window", c.PreferredMaintenanceWindow) @@ -393,8 +393,8 @@ func resourceClusterUpdate(ctx context.Context, d *schema.ResourceData, meta int } } - if d.HasChange("parameter_group_name") { - req.ParameterGroupName = aws.String(d.Get("parameter_group_name").(string)) + if d.HasChange(names.AttrParameterGroupName) { + req.ParameterGroupName = aws.String(d.Get(names.AttrParameterGroupName).(string)) requestUpdate = true } diff --git a/internal/service/dax/cluster_test.go b/internal/service/dax/cluster_test.go index cea985568f2..a134b6048b8 100644 --- a/internal/service/dax/cluster_test.go +++ b/internal/service/dax/cluster_test.go @@ -53,7 +53,7 @@ func TestAccDAXCluster_basic(t *testing.T) { resource.TestCheckResourceAttr( resourceName, names.AttrDescription, "test cluster"), resource.TestMatchResourceAttr( - resourceName, "parameter_group_name", regexache.MustCompile(`^default.dax`)), + resourceName, names.AttrParameterGroupName, regexache.MustCompile(`^default.dax`)), resource.TestMatchResourceAttr( resourceName, "maintenance_window", regexache.MustCompile(`^\w{3}:\d{2}:\d{2}-\w{3}:\d{2}:\d{2}$`)), resource.TestCheckResourceAttr( diff --git a/internal/service/deploy/app.go b/internal/service/deploy/app.go index 89dfce75bf4..c78f5258f14 100644 --- a/internal/service/deploy/app.go +++ b/internal/service/deploy/app.go @@ -61,7 +61,7 @@ func resourceApp() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "application_id": { + names.AttrApplicationID: { Type: schema.TypeString, Computed: true, }, @@ -152,7 +152,7 @@ func resourceAppRead(ctx context.Context, d *schema.ResourceData, meta interface d.SetId(appCreateResourceID(aws.ToString(app.ApplicationId), appName)) } - d.Set("application_id", app.ApplicationId) + d.Set(names.AttrApplicationID, app.ApplicationId) arn := arn.ARN{ Partition: meta.(*conns.AWSClient).Partition, Service: "codedeploy", diff --git a/internal/service/deploy/app_test.go b/internal/service/deploy/app_test.go index c9e851db9b0..4e9faf3b06d 100644 --- a/internal/service/deploy/app_test.go +++ b/internal/service/deploy/app_test.go @@ -42,7 +42,7 @@ func TestAccDeployApp_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttr(resourceName, "linked_to_github", acctest.CtFalse), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct0), - resource.TestCheckResourceAttrSet(resourceName, "application_id"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrApplicationID), ), }, // Import by ID diff --git a/internal/service/directconnect/connection.go b/internal/service/directconnect/connection.go index 34df7df6e1c..626b052f697 100644 --- a/internal/service/directconnect/connection.go +++ b/internal/service/directconnect/connection.go @@ -81,7 +81,7 @@ func ResourceConnection() *schema.Resource { Required: true, ForceNew: true, }, - "owner_account_id": { + names.AttrOwnerAccountID: { Type: schema.TypeString, Computed: true, }, @@ -201,7 +201,7 @@ func ResourceConnection() *schema.Resource { Required: true, ForceNew: true, }, - "owner_account_id": { + names.AttrOwnerAccountID: { Type: schema.TypeString, Computed: true, }, @@ -296,7 +296,7 @@ func resourceConnectionRead(ctx context.Context, d *schema.ResourceData, meta in d.Set("location", connection.Location) d.Set("macsec_capable", connection.MacSecCapable) d.Set(names.AttrName, connection.ConnectionName) - d.Set("owner_account_id", connection.OwnerAccount) + d.Set(names.AttrOwnerAccountID, connection.OwnerAccount) d.Set("partner_name", connection.PartnerName) d.Set("port_encryption_status", connection.PortEncryptionStatus) d.Set(names.AttrProviderName, connection.ProviderName) diff --git a/internal/service/directconnect/connection_data_source.go b/internal/service/directconnect/connection_data_source.go index 2b1436e6cf0..ef79211d55c 100644 --- a/internal/service/directconnect/connection_data_source.go +++ b/internal/service/directconnect/connection_data_source.go @@ -44,7 +44,7 @@ func DataSourceConnection() *schema.Resource { Type: schema.TypeString, Required: true, }, - "owner_account_id": { + names.AttrOwnerAccountID: { Type: schema.TypeString, Computed: true, }, @@ -111,7 +111,7 @@ func dataSourceConnectionRead(ctx context.Context, d *schema.ResourceData, meta d.Set("bandwidth", connection.Bandwidth) d.Set("location", connection.Location) d.Set(names.AttrName, connection.ConnectionName) - d.Set("owner_account_id", connection.OwnerAccount) + d.Set(names.AttrOwnerAccountID, connection.OwnerAccount) d.Set("partner_name", connection.PartnerName) d.Set(names.AttrProviderName, connection.ProviderName) d.Set("vlan_id", connection.Vlan) diff --git a/internal/service/directconnect/connection_data_source_test.go b/internal/service/directconnect/connection_data_source_test.go index 185f6a4eec6..91e6d26b3d0 100644 --- a/internal/service/directconnect/connection_data_source_test.go +++ b/internal/service/directconnect/connection_data_source_test.go @@ -33,7 +33,7 @@ func TestAccDirectConnectConnectionDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(datasourceName, names.AttrID, resourceName, names.AttrID), resource.TestCheckResourceAttrPair(datasourceName, "location", resourceName, "location"), resource.TestCheckResourceAttrPair(datasourceName, names.AttrName, resourceName, names.AttrName), - resource.TestCheckResourceAttrPair(datasourceName, "owner_account_id", resourceName, "owner_account_id"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrOwnerAccountID, resourceName, names.AttrOwnerAccountID), resource.TestCheckResourceAttrPair(datasourceName, "partner_name", resourceName, "partner_name"), resource.TestCheckResourceAttrPair(datasourceName, names.AttrProviderName, resourceName, names.AttrProviderName), resource.TestCheckResourceAttrPair(datasourceName, "vlan_id", resourceName, "vlan_id"), diff --git a/internal/service/directconnect/connection_test.go b/internal/service/directconnect/connection_test.go index c7880b57f8a..f0f18659359 100644 --- a/internal/service/directconnect/connection_test.go +++ b/internal/service/directconnect/connection_test.go @@ -40,7 +40,7 @@ func TestAccDirectConnectConnection_basic(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "directconnect", regexache.MustCompile(`dxcon/.+`)), resource.TestCheckResourceAttr(resourceName, "bandwidth", "1Gbps"), resource.TestCheckResourceAttrSet(resourceName, "location"), - acctest.CheckResourceAttrAccountID(resourceName, "owner_account_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrOwnerAccountID), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttr(resourceName, "partner_name", ""), resource.TestCheckResourceAttr(resourceName, names.AttrProviderName, ""), @@ -161,7 +161,7 @@ func TestAccDirectConnectConnection_macsecRequested(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "bandwidth", "100Gbps"), resource.TestCheckResourceAttrSet(resourceName, "location"), resource.TestCheckResourceAttr(resourceName, "request_macsec", acctest.CtTrue), - acctest.CheckResourceAttrAccountID(resourceName, "owner_account_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrOwnerAccountID), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttrSet(resourceName, names.AttrProviderName), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct0), @@ -196,7 +196,7 @@ func TestAccDirectConnectConnection_providerName(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "directconnect", regexache.MustCompile(`dxcon/.+`)), resource.TestCheckResourceAttr(resourceName, "bandwidth", "1Gbps"), resource.TestCheckResourceAttrSet(resourceName, "location"), - acctest.CheckResourceAttrAccountID(resourceName, "owner_account_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrOwnerAccountID), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttrSet(resourceName, names.AttrProviderName), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct0), diff --git a/internal/service/directconnect/gateway.go b/internal/service/directconnect/gateway.go index d3dcb164a1e..3939ca2c45f 100644 --- a/internal/service/directconnect/gateway.go +++ b/internal/service/directconnect/gateway.go @@ -44,7 +44,7 @@ func ResourceGateway() *schema.Resource { Type: schema.TypeString, Required: true, }, - "owner_account_id": { + names.AttrOwnerAccountID: { Type: schema.TypeString, Computed: true, }, @@ -104,7 +104,7 @@ func resourceGatewayRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set("amazon_side_asn", strconv.FormatInt(aws.Int64Value(output.AmazonSideAsn), 10)) d.Set(names.AttrName, output.DirectConnectGatewayName) - d.Set("owner_account_id", output.OwnerAccount) + d.Set(names.AttrOwnerAccountID, output.OwnerAccount) return diags } diff --git a/internal/service/directconnect/gateway_data_source.go b/internal/service/directconnect/gateway_data_source.go index 1ce1e9dcfcc..867669e9896 100644 --- a/internal/service/directconnect/gateway_data_source.go +++ b/internal/service/directconnect/gateway_data_source.go @@ -30,7 +30,7 @@ func DataSourceGateway() *schema.Resource { Type: schema.TypeString, Required: true, }, - "owner_account_id": { + names.AttrOwnerAccountID: { Type: schema.TypeString, Computed: true, }, @@ -74,7 +74,7 @@ func dataSourceGatewayRead(ctx context.Context, d *schema.ResourceData, meta int d.SetId(aws.StringValue(gateway.DirectConnectGatewayId)) d.Set("amazon_side_asn", strconv.FormatInt(aws.Int64Value(gateway.AmazonSideAsn), 10)) - d.Set("owner_account_id", gateway.OwnerAccount) + d.Set(names.AttrOwnerAccountID, gateway.OwnerAccount) return diags } diff --git a/internal/service/directconnect/gateway_data_source_test.go b/internal/service/directconnect/gateway_data_source_test.go index 61a0f347e07..9ace8ed0a6b 100644 --- a/internal/service/directconnect/gateway_data_source_test.go +++ b/internal/service/directconnect/gateway_data_source_test.go @@ -35,7 +35,7 @@ func TestAccDirectConnectGatewayDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(datasourceName, "amazon_side_asn", resourceName, "amazon_side_asn"), resource.TestCheckResourceAttrPair(datasourceName, names.AttrID, resourceName, names.AttrID), resource.TestCheckResourceAttrPair(datasourceName, names.AttrName, resourceName, names.AttrName), - resource.TestCheckResourceAttrPair(datasourceName, "owner_account_id", resourceName, "owner_account_id"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrOwnerAccountID, resourceName, names.AttrOwnerAccountID), ), }, }, diff --git a/internal/service/directconnect/gateway_test.go b/internal/service/directconnect/gateway_test.go index 4ed78e3b3ed..3bd31a930e5 100644 --- a/internal/service/directconnect/gateway_test.go +++ b/internal/service/directconnect/gateway_test.go @@ -36,7 +36,7 @@ func TestAccDirectConnectGateway_basic(t *testing.T) { Config: testAccGatewayConfig_basic(rName, rBgpAsn), Check: resource.ComposeTestCheckFunc( testAccCheckGatewayExists(ctx, resourceName, &v), - acctest.CheckResourceAttrAccountID(resourceName, "owner_account_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrOwnerAccountID), ), }, { @@ -90,7 +90,7 @@ func TestAccDirectConnectGateway_complex(t *testing.T) { Config: testAccGatewayConfig_associationMultiVPNSingleAccount(rName, rBgpAsn), Check: resource.ComposeTestCheckFunc( testAccCheckGatewayExists(ctx, resourceName, &v), - acctest.CheckResourceAttrAccountID(resourceName, "owner_account_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrOwnerAccountID), ), }, { diff --git a/internal/service/directconnect/hosted_connection.go b/internal/service/directconnect/hosted_connection.go index 67a82e22df0..395a8e49c31 100644 --- a/internal/service/directconnect/hosted_connection.go +++ b/internal/service/directconnect/hosted_connection.go @@ -68,7 +68,7 @@ func ResourceHostedConnection() *schema.Resource { Required: true, ForceNew: true, }, - "owner_account_id": { + names.AttrOwnerAccountID: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -109,7 +109,7 @@ func resourceHostedConnectionCreate(ctx context.Context, d *schema.ResourceData, Bandwidth: aws.String(d.Get("bandwidth").(string)), ConnectionId: aws.String(d.Get("connection_id").(string)), ConnectionName: aws.String(name), - OwnerAccount: aws.String(d.Get("owner_account_id").(string)), + OwnerAccount: aws.String(d.Get(names.AttrOwnerAccountID).(string)), Vlan: aws.Int64(int64(d.Get("vlan").(int))), } @@ -151,7 +151,7 @@ func resourceHostedConnectionRead(ctx context.Context, d *schema.ResourceData, m d.Set("loa_issue_time", aws.TimeValue(connection.LoaIssueTime).Format(time.RFC3339)) d.Set("location", connection.Location) d.Set(names.AttrName, connection.ConnectionName) - d.Set("owner_account_id", connection.OwnerAccount) + d.Set(names.AttrOwnerAccountID, connection.OwnerAccount) d.Set("partner_name", connection.PartnerName) d.Set(names.AttrProviderName, connection.ProviderName) d.Set(names.AttrRegion, connection.Region) diff --git a/internal/service/directconnect/hosted_connection_test.go b/internal/service/directconnect/hosted_connection_test.go index 322e6f1f9fa..19002c15c4c 100644 --- a/internal/service/directconnect/hosted_connection_test.go +++ b/internal/service/directconnect/hosted_connection_test.go @@ -48,7 +48,7 @@ func TestAccDirectConnectHostedConnection_basic(t *testing.T) { testAccCheckHostedConnectionExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, names.AttrName, connectionName), resource.TestCheckResourceAttr(resourceName, "connection_id", env.ConnectionId), - resource.TestCheckResourceAttr(resourceName, "owner_account_id", env.OwnerAccountId), + resource.TestCheckResourceAttr(resourceName, names.AttrOwnerAccountID, env.OwnerAccountId), resource.TestCheckResourceAttr(resourceName, "bandwidth", "100Mbps"), resource.TestCheckResourceAttr(resourceName, "vlan", "4094"), ), diff --git a/internal/service/directconnect/hosted_private_virtual_interface.go b/internal/service/directconnect/hosted_private_virtual_interface.go index 55479c86cfd..e215ea6103e 100644 --- a/internal/service/directconnect/hosted_private_virtual_interface.go +++ b/internal/service/directconnect/hosted_private_virtual_interface.go @@ -98,7 +98,7 @@ func ResourceHostedPrivateVirtualInterface() *schema.Resource { Required: true, ForceNew: true, }, - "owner_account_id": { + names.AttrOwnerAccountID: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -132,7 +132,7 @@ func resourceHostedPrivateVirtualInterfaceCreate(ctx context.Context, d *schema. VirtualInterfaceName: aws.String(d.Get(names.AttrName).(string)), Vlan: aws.Int64(int64(d.Get("vlan").(int))), }, - OwnerAccount: aws.String(d.Get("owner_account_id").(string)), + OwnerAccount: aws.String(d.Get(names.AttrOwnerAccountID).(string)), } if v, ok := d.GetOk("amazon_address"); ok { req.NewPrivateVirtualInterfaceAllocation.AmazonAddress = aws.String(v.(string)) @@ -195,7 +195,7 @@ func resourceHostedPrivateVirtualInterfaceRead(ctx context.Context, d *schema.Re d.Set("jumbo_frame_capable", vif.JumboFrameCapable) d.Set("mtu", vif.Mtu) d.Set(names.AttrName, vif.VirtualInterfaceName) - d.Set("owner_account_id", vif.OwnerAccount) + d.Set(names.AttrOwnerAccountID, vif.OwnerAccount) d.Set("vlan", vif.Vlan) return diags diff --git a/internal/service/directconnect/hosted_private_virtual_interface_test.go b/internal/service/directconnect/hosted_private_virtual_interface_test.go index 2c373db8966..f1113cbc197 100644 --- a/internal/service/directconnect/hosted_private_virtual_interface_test.go +++ b/internal/service/directconnect/hosted_private_virtual_interface_test.go @@ -59,7 +59,7 @@ func TestAccDirectConnectHostedPrivateVirtualInterface_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "jumbo_frame_capable", acctest.CtTrue), resource.TestCheckResourceAttr(resourceName, "mtu", "1500"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttrSet(resourceName, "owner_account_id"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrOwnerAccountID), resource.TestCheckResourceAttr(resourceName, "vlan", strconv.Itoa(vlan)), // Accepter's attributes: resource.TestCheckResourceAttrSet(accepterResourceName, names.AttrARN), @@ -118,7 +118,7 @@ func TestAccDirectConnectHostedPrivateVirtualInterface_accepterTags(t *testing.T resource.TestCheckResourceAttr(resourceName, "jumbo_frame_capable", acctest.CtTrue), resource.TestCheckResourceAttr(resourceName, "mtu", "1500"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttrSet(resourceName, "owner_account_id"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrOwnerAccountID), resource.TestCheckResourceAttr(resourceName, "vlan", strconv.Itoa(vlan)), // Accepter's attributes: resource.TestCheckResourceAttrSet(accepterResourceName, names.AttrARN), @@ -144,7 +144,7 @@ func TestAccDirectConnectHostedPrivateVirtualInterface_accepterTags(t *testing.T resource.TestCheckResourceAttr(resourceName, "jumbo_frame_capable", acctest.CtTrue), resource.TestCheckResourceAttr(resourceName, "mtu", "1500"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttrSet(resourceName, "owner_account_id"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrOwnerAccountID), resource.TestCheckResourceAttr(resourceName, "vlan", strconv.Itoa(vlan)), // Accepter's attributes: resource.TestCheckResourceAttrSet(accepterResourceName, names.AttrARN), diff --git a/internal/service/directconnect/hosted_public_virtual_interface.go b/internal/service/directconnect/hosted_public_virtual_interface.go index 78fd2951310..276704878a1 100644 --- a/internal/service/directconnect/hosted_public_virtual_interface.go +++ b/internal/service/directconnect/hosted_public_virtual_interface.go @@ -88,7 +88,7 @@ func ResourceHostedPublicVirtualInterface() *schema.Resource { Required: true, ForceNew: true, }, - "owner_account_id": { + names.AttrOwnerAccountID: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -128,7 +128,7 @@ func resourceHostedPublicVirtualInterfaceCreate(ctx context.Context, d *schema.R VirtualInterfaceName: aws.String(d.Get(names.AttrName).(string)), Vlan: aws.Int64(int64(d.Get("vlan").(int))), }, - OwnerAccount: aws.String(d.Get("owner_account_id").(string)), + OwnerAccount: aws.String(d.Get(names.AttrOwnerAccountID).(string)), } if v, ok := d.GetOk("amazon_address"); ok { req.NewPublicVirtualInterfaceAllocation.AmazonAddress = aws.String(v.(string)) @@ -189,7 +189,7 @@ func resourceHostedPublicVirtualInterfaceRead(ctx context.Context, d *schema.Res d.Set("connection_id", vif.ConnectionId) d.Set("customer_address", vif.CustomerAddress) d.Set(names.AttrName, vif.VirtualInterfaceName) - d.Set("owner_account_id", vif.OwnerAccount) + d.Set(names.AttrOwnerAccountID, vif.OwnerAccount) if err := d.Set("route_filter_prefixes", flattenRouteFilterPrefixes(vif.RouteFilterPrefixes)); err != nil { return sdkdiag.AppendErrorf(diags, "setting route_filter_prefixes: %s", err) } diff --git a/internal/service/directconnect/hosted_transit_virtual_interface.go b/internal/service/directconnect/hosted_transit_virtual_interface.go index af59b7e98ed..123c50443f2 100644 --- a/internal/service/directconnect/hosted_transit_virtual_interface.go +++ b/internal/service/directconnect/hosted_transit_virtual_interface.go @@ -98,7 +98,7 @@ func ResourceHostedTransitVirtualInterface() *schema.Resource { Required: true, ForceNew: true, }, - "owner_account_id": { + names.AttrOwnerAccountID: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -125,7 +125,7 @@ func resourceHostedTransitVirtualInterfaceCreate(ctx context.Context, d *schema. req := &directconnect.AllocateTransitVirtualInterfaceInput{ ConnectionId: aws.String(d.Get("connection_id").(string)), - OwnerAccount: aws.String(d.Get("owner_account_id").(string)), + OwnerAccount: aws.String(d.Get(names.AttrOwnerAccountID).(string)), NewTransitVirtualInterfaceAllocation: &directconnect.NewTransitVirtualInterfaceAllocation{ AddressFamily: aws.String(d.Get("address_family").(string)), Asn: aws.Int64(int64(d.Get("bgp_asn").(int))), @@ -192,7 +192,7 @@ func resourceHostedTransitVirtualInterfaceRead(ctx context.Context, d *schema.Re d.Set("jumbo_frame_capable", vif.JumboFrameCapable) d.Set("mtu", vif.Mtu) d.Set(names.AttrName, vif.VirtualInterfaceName) - d.Set("owner_account_id", vif.OwnerAccount) + d.Set(names.AttrOwnerAccountID, vif.OwnerAccount) d.Set("vlan", vif.Vlan) return diags diff --git a/internal/service/directconnect/hosted_transit_virtual_interface_test.go b/internal/service/directconnect/hosted_transit_virtual_interface_test.go index 65b2b29d500..c02bacc15bf 100644 --- a/internal/service/directconnect/hosted_transit_virtual_interface_test.go +++ b/internal/service/directconnect/hosted_transit_virtual_interface_test.go @@ -71,7 +71,7 @@ func testAccHostedTransitVirtualInterface_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "jumbo_frame_capable", acctest.CtTrue), resource.TestCheckResourceAttr(resourceName, "mtu", "1500"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttrSet(resourceName, "owner_account_id"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrOwnerAccountID), resource.TestCheckResourceAttr(resourceName, "vlan", strconv.Itoa(vlan)), // Accepter's attributes: resource.TestCheckResourceAttrSet(accepterResourceName, names.AttrARN), @@ -131,7 +131,7 @@ func testAccHostedTransitVirtualInterface_accepterTags(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "jumbo_frame_capable", acctest.CtTrue), resource.TestCheckResourceAttr(resourceName, "mtu", "1500"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttrSet(resourceName, "owner_account_id"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrOwnerAccountID), resource.TestCheckResourceAttr(resourceName, "vlan", strconv.Itoa(vlan)), // Accepter's attributes: resource.TestCheckResourceAttrSet(accepterResourceName, names.AttrARN), @@ -157,7 +157,7 @@ func testAccHostedTransitVirtualInterface_accepterTags(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "jumbo_frame_capable", acctest.CtTrue), resource.TestCheckResourceAttr(resourceName, "mtu", "1500"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttrSet(resourceName, "owner_account_id"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrOwnerAccountID), resource.TestCheckResourceAttr(resourceName, "vlan", strconv.Itoa(vlan)), // Accepter's attributes: resource.TestCheckResourceAttrSet(accepterResourceName, names.AttrARN), diff --git a/internal/service/directconnect/lag.go b/internal/service/directconnect/lag.go index 4c00b1085a2..058c08bca6d 100644 --- a/internal/service/directconnect/lag.go +++ b/internal/service/directconnect/lag.go @@ -72,7 +72,7 @@ func ResourceLag() *schema.Resource { Type: schema.TypeString, Required: true, }, - "owner_account_id": { + names.AttrOwnerAccountID: { Type: schema.TypeString, Computed: true, }, @@ -163,7 +163,7 @@ func resourceLagRead(ctx context.Context, d *schema.ResourceData, meta interface d.Set("jumbo_frame_capable", lag.JumboFrameCapable) d.Set("location", lag.Location) d.Set(names.AttrName, lag.LagName) - d.Set("owner_account_id", lag.OwnerAccount) + d.Set(names.AttrOwnerAccountID, lag.OwnerAccount) d.Set(names.AttrProviderName, lag.ProviderName) return diags diff --git a/internal/service/directconnect/lag_test.go b/internal/service/directconnect/lag_test.go index f1c856f2996..843e276e13a 100644 --- a/internal/service/directconnect/lag_test.go +++ b/internal/service/directconnect/lag_test.go @@ -45,7 +45,7 @@ func TestAccDirectConnectLag_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "jumbo_frame_capable"), resource.TestCheckResourceAttrSet(resourceName, "location"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName1), - acctest.CheckResourceAttrAccountID(resourceName, "owner_account_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrOwnerAccountID), resource.TestCheckResourceAttr(resourceName, names.AttrProviderName, ""), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct0), ), @@ -62,7 +62,7 @@ func TestAccDirectConnectLag_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "jumbo_frame_capable"), resource.TestCheckResourceAttrSet(resourceName, "location"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName2), - acctest.CheckResourceAttrAccountID(resourceName, "owner_account_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrOwnerAccountID), resource.TestCheckResourceAttr(resourceName, names.AttrProviderName, ""), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct0), ), @@ -126,7 +126,7 @@ func TestAccDirectConnectLag_connectionID(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "jumbo_frame_capable"), resource.TestCheckResourceAttrSet(resourceName, "location"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - acctest.CheckResourceAttrAccountID(resourceName, "owner_account_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrOwnerAccountID), resource.TestCheckResourceAttr(resourceName, names.AttrProviderName, ""), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct0), ), @@ -165,7 +165,7 @@ func TestAccDirectConnectLag_providerName(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "jumbo_frame_capable"), resource.TestCheckResourceAttrSet(resourceName, "location"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - acctest.CheckResourceAttrAccountID(resourceName, "owner_account_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrOwnerAccountID), resource.TestCheckResourceAttrSet(resourceName, names.AttrProviderName), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct0), ), diff --git a/internal/service/dms/s3_endpoint.go b/internal/service/dms/s3_endpoint.go index f79584d3d26..90833c20427 100644 --- a/internal/service/dms/s3_endpoint.go +++ b/internal/service/dms/s3_endpoint.go @@ -231,7 +231,7 @@ func ResourceS3Endpoint() *schema.Resource { Optional: true, ValidateFunc: validation.StringInSlice(encryptionMode_Values(), false), }, - "expected_bucket_owner": { + names.AttrExpectedBucketOwner: { Type: schema.TypeString, Optional: true, ValidateFunc: verify.ValidAccountID, @@ -445,7 +445,7 @@ func resourceS3EndpointRead(ctx context.Context, d *schema.ResourceData, meta in d.Set("dict_page_size_limit", s3settings.DictPageSizeLimit) d.Set("enable_statistics", s3settings.EnableStatistics) d.Set("encoding_type", s3settings.EncodingType) - d.Set("expected_bucket_owner", s3settings.ExpectedBucketOwner) + d.Set(names.AttrExpectedBucketOwner, s3settings.ExpectedBucketOwner) d.Set("ignore_header_rows", s3settings.IgnoreHeaderRows) d.Set("include_op_for_full_load", s3settings.IncludeOpForFullLoad) d.Set("max_file_size", s3settings.MaxFileSize) @@ -672,7 +672,7 @@ func s3Settings(d *schema.ResourceData, target bool) *dms.S3Settings { s3s.EncryptionMode = aws.String(v.(string)) } - if v, ok := d.GetOk("expected_bucket_owner"); ok { // likely only useful for target + if v, ok := d.GetOk(names.AttrExpectedBucketOwner); ok { // likely only useful for target s3s.ExpectedBucketOwner = aws.String(v.(string)) } diff --git a/internal/service/dms/s3_endpoint_test.go b/internal/service/dms/s3_endpoint_test.go index 1850557f612..6a994c62d04 100644 --- a/internal/service/dms/s3_endpoint_test.go +++ b/internal/service/dms/s3_endpoint_test.go @@ -53,7 +53,7 @@ func TestAccDMSS3Endpoint_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enable_statistics", acctest.CtFalse), resource.TestCheckResourceAttr(resourceName, "encoding_type", "plain"), resource.TestCheckResourceAttr(resourceName, "encryption_mode", "SSE_S3"), - resource.TestCheckResourceAttrPair(resourceName, "expected_bucket_owner", "data.aws_caller_identity.current", names.AttrAccountID), + resource.TestCheckResourceAttrPair(resourceName, names.AttrExpectedBucketOwner, "data.aws_caller_identity.current", names.AttrAccountID), resource.TestCheckResourceAttr(resourceName, "glue_catalog_generation", acctest.CtTrue), resource.TestCheckResourceAttr(resourceName, "ignore_header_rows", acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "include_op_for_full_load", acctest.CtTrue), @@ -118,7 +118,7 @@ func TestAccDMSS3Endpoint_update(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enable_statistics", acctest.CtFalse), resource.TestCheckResourceAttr(resourceName, "encoding_type", "plain"), resource.TestCheckResourceAttr(resourceName, "encryption_mode", "SSE_S3"), - resource.TestCheckResourceAttrPair(resourceName, "expected_bucket_owner", "data.aws_caller_identity.current", names.AttrAccountID), + resource.TestCheckResourceAttrPair(resourceName, names.AttrExpectedBucketOwner, "data.aws_caller_identity.current", names.AttrAccountID), resource.TestCheckResourceAttr(resourceName, "glue_catalog_generation", acctest.CtTrue), resource.TestCheckResourceAttr(resourceName, "ignore_header_rows", acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "include_op_for_full_load", acctest.CtTrue), @@ -164,7 +164,7 @@ func TestAccDMSS3Endpoint_update(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enable_statistics", acctest.CtTrue), resource.TestCheckResourceAttr(resourceName, "encoding_type", "plain"), resource.TestCheckResourceAttr(resourceName, "encryption_mode", "SSE_S3"), - resource.TestCheckResourceAttrPair(resourceName, "expected_bucket_owner", "data.aws_caller_identity.current", names.AttrAccountID), + resource.TestCheckResourceAttrPair(resourceName, names.AttrExpectedBucketOwner, "data.aws_caller_identity.current", names.AttrAccountID), resource.TestCheckResourceAttr(resourceName, "glue_catalog_generation", acctest.CtFalse), resource.TestCheckResourceAttr(resourceName, "ignore_header_rows", acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "include_op_for_full_load", acctest.CtFalse), @@ -225,7 +225,7 @@ func TestAccDMSS3Endpoint_simple(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enable_statistics", acctest.CtTrue), resource.TestCheckResourceAttr(resourceName, "encoding_type", ""), resource.TestCheckResourceAttr(resourceName, "encryption_mode", ""), - resource.TestCheckResourceAttr(resourceName, "expected_bucket_owner", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrExpectedBucketOwner, ""), resource.TestCheckResourceAttr(resourceName, "glue_catalog_generation", acctest.CtFalse), resource.TestCheckResourceAttr(resourceName, "ignore_header_rows", acctest.Ct0), resource.TestCheckResourceAttr(resourceName, "include_op_for_full_load", acctest.CtFalse), @@ -285,7 +285,7 @@ func TestAccDMSS3Endpoint_sourceSimple(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "encoding_type", ""), resource.TestCheckResourceAttr(resourceName, "endpoint_id", rName), resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, names.AttrSource), - resource.TestCheckResourceAttr(resourceName, "expected_bucket_owner", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrExpectedBucketOwner, ""), resource.TestCheckResourceAttr(resourceName, "external_table_definition", "{\"TableCount\":1,\"Tables\":[{\"TableColumns\":[{\"ColumnIsPk\":\"true\",\"ColumnName\":\"ID\",\"ColumnNullable\":\"false\",\"ColumnType\":\"INT8\"},{\"ColumnLength\":\"20\",\"ColumnName\":\"LastName\",\"ColumnType\":\"STRING\"}],\"TableColumnsTotal\":\"2\",\"TableName\":\"employee\",\"TableOwner\":\"hr\",\"TablePath\":\"hr/employee/\"}]}"), resource.TestCheckResourceAttr(resourceName, "ignore_header_rows", acctest.Ct0), resource.TestCheckResourceAttr(resourceName, "include_op_for_full_load", acctest.CtFalse), @@ -350,7 +350,7 @@ func TestAccDMSS3Endpoint_source(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "dict_page_size_limit", "1000000"), resource.TestCheckResourceAttr(resourceName, "enable_statistics", acctest.CtFalse), resource.TestCheckResourceAttr(resourceName, "encoding_type", "plain"), - resource.TestCheckResourceAttrPair(resourceName, "expected_bucket_owner", "data.aws_caller_identity.current", names.AttrAccountID), + resource.TestCheckResourceAttrPair(resourceName, names.AttrExpectedBucketOwner, "data.aws_caller_identity.current", names.AttrAccountID), resource.TestCheckResourceAttr(resourceName, "external_table_definition", "{\"TableCount\":1,\"Tables\":[{\"TableColumns\":[{\"ColumnIsPk\":\"true\",\"ColumnName\":\"ID\",\"ColumnNullable\":\"false\",\"ColumnType\":\"INT8\"},{\"ColumnLength\":\"20\",\"ColumnName\":\"LastName\",\"ColumnType\":\"STRING\"}],\"TableColumnsTotal\":\"2\",\"TableName\":\"employee\",\"TableOwner\":\"hr\",\"TablePath\":\"hr/employee/\"}]}"), resource.TestCheckResourceAttr(resourceName, "include_op_for_full_load", acctest.CtTrue), resource.TestCheckResourceAttr(resourceName, "max_file_size", "1000000"), @@ -387,7 +387,7 @@ func TestAccDMSS3Endpoint_source(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "dict_page_size_limit", "830000"), resource.TestCheckResourceAttr(resourceName, "enable_statistics", acctest.CtTrue), resource.TestCheckResourceAttr(resourceName, "encoding_type", "plain-dictionary"), - resource.TestCheckResourceAttrPair(resourceName, "expected_bucket_owner", "data.aws_caller_identity.current", names.AttrAccountID), + resource.TestCheckResourceAttrPair(resourceName, names.AttrExpectedBucketOwner, "data.aws_caller_identity.current", names.AttrAccountID), resource.TestCheckResourceAttr(resourceName, "external_table_definition", "{\"TableCount\":1,\"Tables\":[{\"TableColumns\":[{\"ColumnIsPk\":\"true\",\"ColumnName\":\"ID\",\"ColumnNullable\":\"false\",\"ColumnType\":\"INT8\"}],\"TableColumnsTotal\":\"1\",\"TableName\":\"employee\",\"TableOwner\":\"hr\",\"TablePath\":\"hr/employee/\"}]}"), resource.TestCheckResourceAttr(resourceName, "include_op_for_full_load", acctest.CtFalse), resource.TestCheckResourceAttr(resourceName, "max_file_size", "100"), diff --git a/internal/service/docdb/cluster.go b/internal/service/docdb/cluster.go index fb2e242a9a0..d735d41c1ee 100644 --- a/internal/service/docdb/cluster.go +++ b/internal/service/docdb/cluster.go @@ -136,7 +136,7 @@ func ResourceCluster() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -236,7 +236,7 @@ func ResourceCluster() *schema.Resource { return new == "" }, }, - "storage_encrypted": { + names.AttrStorageEncrypted: { Type: schema.TypeBool, Optional: true, ForceNew: true, @@ -293,7 +293,7 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, meta int input := &docdb.RestoreDBClusterFromSnapshotInput{ DBClusterIdentifier: aws.String(identifier), DeletionProtection: aws.Bool(d.Get("deletion_protection").(bool)), - Engine: aws.String(d.Get("engine").(string)), + Engine: aws.String(d.Get(names.AttrEngine).(string)), SnapshotIdentifier: aws.String(d.Get("snapshot_identifier").(string)), Tags: getTagsIn(ctx), } @@ -375,7 +375,7 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, meta int input := &docdb.CreateDBClusterInput{ DBClusterIdentifier: aws.String(identifier), DeletionProtection: aws.Bool(d.Get("deletion_protection").(bool)), - Engine: aws.String(d.Get("engine").(string)), + Engine: aws.String(d.Get(names.AttrEngine).(string)), MasterUsername: aws.String(d.Get("master_username").(string)), MasterUserPassword: aws.String(d.Get("master_password").(string)), Tags: getTagsIn(ctx), @@ -425,7 +425,7 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, meta int input.PreferredMaintenanceWindow = aws.String(v.(string)) } - if v, ok := d.GetOk("storage_encrypted"); ok { + if v, ok := d.GetOk(names.AttrStorageEncrypted); ok { input.StorageEncrypted = aws.Bool(v.(bool)) } @@ -512,7 +512,7 @@ func resourceClusterRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set("enabled_cloudwatch_logs_exports", aws.StringValueSlice(dbc.EnabledCloudwatchLogsExports)) d.Set(names.AttrEndpoint, dbc.Endpoint) d.Set(names.AttrEngineVersion, dbc.EngineVersion) - d.Set("engine", dbc.Engine) + d.Set(names.AttrEngine, dbc.Engine) d.Set(names.AttrHostedZoneID, dbc.HostedZoneId) d.Set(names.AttrKMSKeyID, dbc.KmsKeyId) d.Set("master_username", dbc.MasterUsername) @@ -520,7 +520,7 @@ func resourceClusterRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set("preferred_backup_window", dbc.PreferredBackupWindow) d.Set(names.AttrPreferredMaintenanceWindow, dbc.PreferredMaintenanceWindow) d.Set("reader_endpoint", dbc.ReaderEndpoint) - d.Set("storage_encrypted", dbc.StorageEncrypted) + d.Set(names.AttrStorageEncrypted, dbc.StorageEncrypted) d.Set(names.AttrStorageType, dbc.StorageType) var securityGroupIDs []string for _, v := range dbc.VpcSecurityGroups { diff --git a/internal/service/docdb/cluster_instance.go b/internal/service/docdb/cluster_instance.go index dfde5114006..23a1f33a8b7 100644 --- a/internal/service/docdb/cluster_instance.go +++ b/internal/service/docdb/cluster_instance.go @@ -95,7 +95,7 @@ func ResourceClusterInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -165,7 +165,7 @@ func ResourceClusterInstance() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "storage_encrypted": { + names.AttrStorageEncrypted: { Type: schema.TypeBool, Computed: true, }, @@ -195,7 +195,7 @@ func resourceClusterInstanceCreate(ctx context.Context, d *schema.ResourceData, DBClusterIdentifier: aws.String(d.Get(names.AttrClusterIdentifier).(string)), DBInstanceClass: aws.String(d.Get("instance_class").(string)), DBInstanceIdentifier: aws.String(identifier), - Engine: aws.String(d.Get("engine").(string)), + Engine: aws.String(d.Get(names.AttrEngine).(string)), PromotionTier: aws.Int64(int64(d.Get("promotion_tier").(int))), Tags: getTagsIn(ctx), } @@ -277,7 +277,7 @@ func resourceClusterInstanceRead(ctx context.Context, d *schema.ResourceData, me d.Set(names.AttrEndpoint, db.Endpoint.Address) d.Set(names.AttrPort, db.Endpoint.Port) } - d.Set("engine", db.Engine) + d.Set(names.AttrEngine, db.Engine) d.Set(names.AttrEngineVersion, db.EngineVersion) d.Set(names.AttrIdentifier, db.DBInstanceIdentifier) d.Set("identifier_prefix", create.NamePrefixFromName(aws.StringValue(db.DBInstanceIdentifier))) @@ -290,7 +290,7 @@ func resourceClusterInstanceRead(ctx context.Context, d *schema.ResourceData, me d.Set(names.AttrPreferredMaintenanceWindow, db.PreferredMaintenanceWindow) d.Set("promotion_tier", db.PromotionTier) d.Set(names.AttrPubliclyAccessible, db.PubliclyAccessible) - d.Set("storage_encrypted", db.StorageEncrypted) + d.Set(names.AttrStorageEncrypted, db.StorageEncrypted) if v := tfslices.Filter(dbc.DBClusterMembers, func(v *docdb.DBClusterMember) bool { return aws.StringValue(v.DBInstanceIdentifier) == d.Id() }); len(v) == 1 { diff --git a/internal/service/docdb/cluster_instance_test.go b/internal/service/docdb/cluster_instance_test.go index a5e18f413a3..d2b8befda8a 100644 --- a/internal/service/docdb/cluster_instance_test.go +++ b/internal/service/docdb/cluster_instance_test.go @@ -47,7 +47,7 @@ func TestAccDocDBClusterInstance_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "dbi_resource_id"), resource.TestCheckNoResourceAttr(resourceName, "enable_performance_insights"), resource.TestCheckResourceAttrSet(resourceName, names.AttrEndpoint), - resource.TestCheckResourceAttr(resourceName, "engine", "docdb"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "docdb"), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), resource.TestCheckResourceAttr(resourceName, names.AttrIdentifier, rName), resource.TestCheckResourceAttr(resourceName, "identifier_prefix", ""), @@ -59,7 +59,7 @@ func TestAccDocDBClusterInstance_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, names.AttrPreferredMaintenanceWindow), resource.TestCheckResourceAttr(resourceName, "promotion_tier", acctest.Ct0), resource.TestCheckResourceAttrSet(resourceName, names.AttrPubliclyAccessible), - resource.TestCheckResourceAttrSet(resourceName, "storage_encrypted"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrStorageEncrypted), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct0), resource.TestCheckResourceAttr(resourceName, "writer", acctest.CtTrue), ), diff --git a/internal/service/docdb/cluster_snapshot.go b/internal/service/docdb/cluster_snapshot.go index 0b72e98cd16..c93b850c6f6 100644 --- a/internal/service/docdb/cluster_snapshot.go +++ b/internal/service/docdb/cluster_snapshot.go @@ -57,7 +57,7 @@ func ResourceClusterSnapshot() *schema.Resource { ForceNew: true, ValidateFunc: validClusterSnapshotIdentifier, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Computed: true, }, @@ -85,7 +85,7 @@ func ResourceClusterSnapshot() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "storage_encrypted": { + names.AttrStorageEncrypted: { Type: schema.TypeBool, Computed: true, }, @@ -143,13 +143,13 @@ func resourceClusterSnapshotRead(ctx context.Context, d *schema.ResourceData, me d.Set("db_cluster_snapshot_arn", snapshot.DBClusterSnapshotArn) d.Set("db_cluster_snapshot_identifier", snapshot.DBClusterSnapshotIdentifier) d.Set(names.AttrEngineVersion, snapshot.EngineVersion) - d.Set("engine", snapshot.Engine) + d.Set(names.AttrEngine, snapshot.Engine) d.Set(names.AttrKMSKeyID, snapshot.KmsKeyId) d.Set(names.AttrPort, snapshot.Port) d.Set("snapshot_type", snapshot.SnapshotType) d.Set("source_db_cluster_snapshot_arn", snapshot.SourceDBClusterSnapshotArn) d.Set(names.AttrStatus, snapshot.Status) - d.Set("storage_encrypted", snapshot.StorageEncrypted) + d.Set(names.AttrStorageEncrypted, snapshot.StorageEncrypted) d.Set(names.AttrVPCID, snapshot.VpcId) return diags diff --git a/internal/service/docdb/cluster_snapshot_test.go b/internal/service/docdb/cluster_snapshot_test.go index 7622cd830ed..4c21c913653 100644 --- a/internal/service/docdb/cluster_snapshot_test.go +++ b/internal/service/docdb/cluster_snapshot_test.go @@ -38,14 +38,14 @@ func TestAccDocDBClusterSnapshot_basic(t *testing.T) { testAccCheckClusterSnapshotExists(ctx, resourceName, &dbClusterSnapshot), resource.TestCheckResourceAttrSet(resourceName, "availability_zones.#"), acctest.MatchResourceAttrRegionalARN(resourceName, "db_cluster_snapshot_arn", "rds", regexache.MustCompile(`cluster-snapshot:.+`)), - resource.TestCheckResourceAttrSet(resourceName, "engine"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEngine), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyID, ""), resource.TestCheckResourceAttrSet(resourceName, names.AttrPort), resource.TestCheckResourceAttr(resourceName, "snapshot_type", "manual"), resource.TestCheckResourceAttr(resourceName, "source_db_cluster_snapshot_arn", ""), resource.TestCheckResourceAttr(resourceName, names.AttrStatus, "available"), - resource.TestCheckResourceAttr(resourceName, "storage_encrypted", acctest.CtFalse), + resource.TestCheckResourceAttr(resourceName, names.AttrStorageEncrypted, acctest.CtFalse), resource.TestCheckResourceAttrPair(resourceName, names.AttrVPCID, "aws_vpc.test", names.AttrID), ), }, diff --git a/internal/service/docdb/cluster_test.go b/internal/service/docdb/cluster_test.go index d4e8be5d9c5..c34579116ed 100644 --- a/internal/service/docdb/cluster_test.go +++ b/internal/service/docdb/cluster_test.go @@ -65,7 +65,7 @@ func TestAccDocDBCluster_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enabled_cloudwatch_logs_exports.0", "audit"), resource.TestCheckResourceAttr(resourceName, "enabled_cloudwatch_logs_exports.1", "profiler"), resource.TestCheckResourceAttrSet(resourceName, names.AttrEndpoint), - resource.TestCheckResourceAttr(resourceName, "engine", "docdb"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "docdb"), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), resource.TestCheckNoResourceAttr(resourceName, "final_snapshot_identifier"), resource.TestCheckResourceAttr(resourceName, "global_cluster_identifier", ""), @@ -79,7 +79,7 @@ func TestAccDocDBCluster_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "reader_endpoint"), resource.TestCheckResourceAttr(resourceName, "skip_final_snapshot", acctest.CtTrue), resource.TestCheckNoResourceAttr(resourceName, "snapshot_identifier"), - resource.TestCheckResourceAttr(resourceName, "storage_encrypted", acctest.CtFalse), + resource.TestCheckResourceAttr(resourceName, names.AttrStorageEncrypted, acctest.CtFalse), resource.TestCheckResourceAttr(resourceName, names.AttrStorageType, ""), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct0), resource.TestCheckResourceAttr(resourceName, "vpc_security_group_ids.#", acctest.Ct1), @@ -398,7 +398,7 @@ func TestAccDocDBCluster_encrypted(t *testing.T) { Config: testAccClusterConfig_encrypted(rName), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "storage_encrypted", acctest.CtTrue), + resource.TestCheckResourceAttr(resourceName, names.AttrStorageEncrypted, acctest.CtTrue), ), }, { @@ -793,7 +793,7 @@ func TestAccDocDBCluster_updateEngineMajorVersion(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "deletion_protection", acctest.CtFalse), resource.TestCheckResourceAttr(resourceName, "enabled_cloudwatch_logs_exports.#", acctest.Ct0), resource.TestCheckResourceAttrSet(resourceName, names.AttrEndpoint), - resource.TestCheckResourceAttr(resourceName, "engine", "docdb"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "docdb"), resource.TestCheckResourceAttr(resourceName, names.AttrEngineVersion, "4.0.0"), resource.TestCheckNoResourceAttr(resourceName, "final_snapshot_identifier"), resource.TestCheckResourceAttr(resourceName, "global_cluster_identifier", ""), @@ -807,7 +807,7 @@ func TestAccDocDBCluster_updateEngineMajorVersion(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "reader_endpoint"), resource.TestCheckResourceAttr(resourceName, "skip_final_snapshot", acctest.CtTrue), resource.TestCheckNoResourceAttr(resourceName, "snapshot_identifier"), - resource.TestCheckResourceAttr(resourceName, "storage_encrypted", acctest.CtFalse), + resource.TestCheckResourceAttr(resourceName, names.AttrStorageEncrypted, acctest.CtFalse), resource.TestCheckResourceAttr(resourceName, names.AttrStorageType, ""), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct0), resource.TestCheckResourceAttr(resourceName, "vpc_security_group_ids.#", acctest.Ct1), diff --git a/internal/service/docdb/engine_version_data_source.go b/internal/service/docdb/engine_version_data_source.go index 24575dd68c4..357bb6c2d4b 100644 --- a/internal/service/docdb/engine_version_data_source.go +++ b/internal/service/docdb/engine_version_data_source.go @@ -23,7 +23,7 @@ func DataSourceEngineVersion() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceEngineVersionRead, Schema: map[string]*schema.Schema{ - "engine": { + names.AttrEngine: { Type: schema.TypeString, Optional: true, Default: engineDocDB, @@ -77,7 +77,7 @@ func dataSourceEngineVersionRead(ctx context.Context, d *schema.ResourceData, me input := &docdb.DescribeDBEngineVersionsInput{} - if v, ok := d.GetOk("engine"); ok { + if v, ok := d.GetOk(names.AttrEngine); ok { input.Engine = aws.String(v.(string)) } @@ -125,7 +125,7 @@ func dataSourceEngineVersionRead(ctx context.Context, d *schema.ResourceData, me } d.SetId(aws.StringValue(engineVersion.EngineVersion)) - d.Set("engine", engineVersion.Engine) + d.Set(names.AttrEngine, engineVersion.Engine) d.Set("engine_description", engineVersion.DBEngineDescription) d.Set("exportable_log_types", engineVersion.ExportableLogTypes) d.Set("parameter_group_family", engineVersion.DBParameterGroupFamily) diff --git a/internal/service/docdb/engine_version_data_source_test.go b/internal/service/docdb/engine_version_data_source_test.go index 7ba5a7168a3..71bc4b15733 100644 --- a/internal/service/docdb/engine_version_data_source_test.go +++ b/internal/service/docdb/engine_version_data_source_test.go @@ -31,7 +31,7 @@ func TestAccDocDBEngineVersionDataSource_basic(t *testing.T) { { Config: testAccEngineVersionDataSourceConfig_basic(engine, version), Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr(dataSourceName, "engine", engine), + resource.TestCheckResourceAttr(dataSourceName, names.AttrEngine, engine), resource.TestCheckResourceAttr(dataSourceName, names.AttrVersion, version), resource.TestCheckResourceAttrSet(dataSourceName, "engine_description"), resource.TestMatchResourceAttr(dataSourceName, "exportable_log_types.#", regexache.MustCompile(`^[1-9][0-9]*`)), @@ -75,7 +75,7 @@ func TestAccDocDBEngineVersionDataSource_defaultOnly(t *testing.T) { { Config: testAccEngineVersionDataSourceConfig_defaultOnly(), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(dataSourceName, "engine", "docdb"), + resource.TestCheckResourceAttr(dataSourceName, names.AttrEngine, "docdb"), resource.TestCheckResourceAttrSet(dataSourceName, names.AttrVersion), ), }, diff --git a/internal/service/docdb/global_cluster.go b/internal/service/docdb/global_cluster.go index b744547a4dd..32124cf8779 100644 --- a/internal/service/docdb/global_cluster.go +++ b/internal/service/docdb/global_cluster.go @@ -56,13 +56,13 @@ func ResourceGlobalCluster() *schema.Resource { Optional: true, Default: false, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, ValidateFunc: validation.StringInSlice(engine_Values(), false), - AtLeastOneOf: []string{"engine", "source_db_cluster_identifier"}, + AtLeastOneOf: []string{names.AttrEngine, "source_db_cluster_identifier"}, ConflictsWith: []string{"source_db_cluster_identifier"}, }, names.AttrEngineVersion: { @@ -101,14 +101,14 @@ func ResourceGlobalCluster() *schema.Resource { Optional: true, Computed: true, ForceNew: true, - AtLeastOneOf: []string{"engine", "source_db_cluster_identifier"}, - ConflictsWith: []string{"engine"}, + AtLeastOneOf: []string{names.AttrEngine, "source_db_cluster_identifier"}, + ConflictsWith: []string{names.AttrEngine}, }, names.AttrStatus: { Type: schema.TypeString, Computed: true, }, - "storage_encrypted": { + names.AttrStorageEncrypted: { Type: schema.TypeBool, Optional: true, Computed: true, @@ -136,7 +136,7 @@ func resourceGlobalClusterCreate(ctx context.Context, d *schema.ResourceData, me input.DeletionProtection = aws.Bool(v.(bool)) } - if v, ok := d.GetOk("engine"); ok { + if v, ok := d.GetOk(names.AttrEngine); ok { input.Engine = aws.String(v.(string)) } @@ -148,7 +148,7 @@ func resourceGlobalClusterCreate(ctx context.Context, d *schema.ResourceData, me input.SourceDBClusterIdentifier = aws.String(v.(string)) } - if v, ok := d.GetOk("storage_encrypted"); ok { + if v, ok := d.GetOk(names.AttrStorageEncrypted); ok { input.StorageEncrypted = aws.Bool(v.(bool)) } @@ -187,14 +187,14 @@ func resourceGlobalClusterRead(ctx context.Context, d *schema.ResourceData, meta d.Set(names.AttrARN, globalCluster.GlobalClusterArn) d.Set(names.AttrDatabaseName, globalCluster.DatabaseName) d.Set("deletion_protection", globalCluster.DeletionProtection) - d.Set("engine", globalCluster.Engine) + d.Set(names.AttrEngine, globalCluster.Engine) d.Set(names.AttrEngineVersion, globalCluster.EngineVersion) d.Set("global_cluster_identifier", globalCluster.GlobalClusterIdentifier) if err := d.Set("global_cluster_members", flattenGlobalClusterMembers(globalCluster.GlobalClusterMembers)); err != nil { return sdkdiag.AppendErrorf(diags, "setting global_cluster_members: %s", err) } d.Set("global_cluster_resource_id", globalCluster.GlobalClusterResourceId) - d.Set("storage_encrypted", globalCluster.StorageEncrypted) + d.Set(names.AttrStorageEncrypted, globalCluster.StorageEncrypted) return diags } diff --git a/internal/service/docdb/global_cluster_test.go b/internal/service/docdb/global_cluster_test.go index c60f4dcccb9..60fe866ec26 100644 --- a/internal/service/docdb/global_cluster_test.go +++ b/internal/service/docdb/global_cluster_test.go @@ -43,11 +43,11 @@ func TestAccDocDBGlobalCluster_basic(t *testing.T) { acctest.CheckResourceAttrGlobalARN(resourceName, names.AttrARN, "rds", fmt.Sprintf("global-cluster:%s", rName)), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, ""), resource.TestCheckResourceAttr(resourceName, "deletion_protection", acctest.CtFalse), - resource.TestCheckResourceAttrSet(resourceName, "engine"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEngine), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), resource.TestCheckResourceAttr(resourceName, "global_cluster_identifier", rName), resource.TestMatchResourceAttr(resourceName, "global_cluster_resource_id", regexache.MustCompile(`cluster-.+`)), - resource.TestCheckResourceAttr(resourceName, "storage_encrypted", acctest.CtFalse), + resource.TestCheckResourceAttr(resourceName, names.AttrStorageEncrypted, acctest.CtFalse), ), }, { @@ -171,7 +171,7 @@ func TestAccDocDBGlobalCluster_Engine(t *testing.T) { Config: testAccGlobalClusterConfig_engine(rName, "docdb"), Check: resource.ComposeTestCheckFunc( testAccCheckGlobalClusterExists(ctx, resourceName, &globalCluster), - resource.TestCheckResourceAttr(resourceName, "engine", "docdb"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "docdb"), ), }, { @@ -287,7 +287,7 @@ func TestAccDocDBGlobalCluster_StorageEncrypted(t *testing.T) { Config: testAccGlobalClusterConfig_storageEncrypted(rName, true), Check: resource.ComposeTestCheckFunc( testAccCheckGlobalClusterExists(ctx, resourceName, &globalCluster1), - resource.TestCheckResourceAttr(resourceName, "storage_encrypted", acctest.CtTrue), + resource.TestCheckResourceAttr(resourceName, names.AttrStorageEncrypted, acctest.CtTrue), ), }, { @@ -300,7 +300,7 @@ func TestAccDocDBGlobalCluster_StorageEncrypted(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckGlobalClusterExists(ctx, resourceName, &globalCluster2), testAccCheckGlobalClusterRecreated(&globalCluster1, &globalCluster2), - resource.TestCheckResourceAttr(resourceName, "storage_encrypted", acctest.CtFalse), + resource.TestCheckResourceAttr(resourceName, names.AttrStorageEncrypted, acctest.CtFalse), ), }, }, diff --git a/internal/service/docdb/orderable_db_instance_data_source.go b/internal/service/docdb/orderable_db_instance_data_source.go index 1409bc27101..1f46839cabb 100644 --- a/internal/service/docdb/orderable_db_instance_data_source.go +++ b/internal/service/docdb/orderable_db_instance_data_source.go @@ -28,7 +28,7 @@ func DataSourceOrderableDBInstance() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Optional: true, Default: engineDocDB, @@ -74,7 +74,7 @@ func dataSourceOrderableDBInstanceRead(ctx context.Context, d *schema.ResourceDa input.DBInstanceClass = aws.String(v.(string)) } - if v, ok := d.GetOk("engine"); ok { + if v, ok := d.GetOk(names.AttrEngine); ok { input.Engine = aws.String(v.(string)) } @@ -123,7 +123,7 @@ func dataSourceOrderableDBInstanceRead(ctx context.Context, d *schema.ResourceDa d.Set(names.AttrAvailabilityZones, tfslices.ApplyToAll(orderableDBInstance.AvailabilityZones, func(v *docdb.AvailabilityZone) string { return aws.StringValue(v.Name) })) - d.Set("engine", orderableDBInstance.Engine) + d.Set(names.AttrEngine, orderableDBInstance.Engine) d.Set(names.AttrEngineVersion, orderableDBInstance.EngineVersion) d.Set("instance_class", orderableDBInstance.DBInstanceClass) d.Set("license_model", orderableDBInstance.LicenseModel) diff --git a/internal/service/docdb/orderable_db_instance_data_source_test.go b/internal/service/docdb/orderable_db_instance_data_source_test.go index 082671d5647..c3902cce980 100644 --- a/internal/service/docdb/orderable_db_instance_data_source_test.go +++ b/internal/service/docdb/orderable_db_instance_data_source_test.go @@ -33,7 +33,7 @@ func TestAccDocDBOrderableDBInstanceDataSource_basic(t *testing.T) { Config: testAccOrderableDBInstanceDataSourceConfig_basic(class, engine, engineVersion, license), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(dataSourceName, "instance_class", class), - resource.TestCheckResourceAttr(dataSourceName, "engine", engine), + resource.TestCheckResourceAttr(dataSourceName, names.AttrEngine, engine), resource.TestCheckResourceAttr(dataSourceName, names.AttrEngineVersion, engineVersion), resource.TestCheckResourceAttr(dataSourceName, "license_model", license), ), @@ -58,7 +58,7 @@ func TestAccDocDBOrderableDBInstanceDataSource_preferred(t *testing.T) { { Config: testAccOrderableDBInstanceDataSourceConfig_preferred(engine, engineVersion, license, preferredOption), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(dataSourceName, "engine", engine), + resource.TestCheckResourceAttr(dataSourceName, names.AttrEngine, engine), resource.TestCheckResourceAttr(dataSourceName, names.AttrEngineVersion, engineVersion), resource.TestCheckResourceAttr(dataSourceName, "license_model", license), resource.TestCheckResourceAttr(dataSourceName, "instance_class", preferredOption), diff --git a/internal/service/ds/shared_directory_accepter.go b/internal/service/ds/shared_directory_accepter.go index 2be0f9b2fdf..dee7835af99 100644 --- a/internal/service/ds/shared_directory_accepter.go +++ b/internal/service/ds/shared_directory_accepter.go @@ -49,7 +49,7 @@ func ResourceSharedDirectoryAccepter() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "owner_account_id": { + names.AttrOwnerAccountID: { Type: schema.TypeString, Computed: true, }, @@ -112,7 +112,7 @@ func resourceSharedDirectoryAccepterRead(ctx context.Context, d *schema.Resource } d.Set("method", dir.ShareMethod) - d.Set("owner_account_id", dir.OwnerDirectoryDescription.AccountId) + d.Set(names.AttrOwnerAccountID, dir.OwnerDirectoryDescription.AccountId) d.Set("owner_directory_id", dir.OwnerDirectoryDescription.DirectoryId) d.Set("shared_directory_id", dir.DirectoryId) diff --git a/internal/service/ds/shared_directory_accepter_test.go b/internal/service/ds/shared_directory_accepter_test.go index 5f7aa3f9ace..d4abeca1921 100644 --- a/internal/service/ds/shared_directory_accepter_test.go +++ b/internal/service/ds/shared_directory_accepter_test.go @@ -40,7 +40,7 @@ func TestAccDSSharedDirectoryAccepter_basic(t *testing.T) { testAccCheckSharedDirectoryAccepterExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "method", directoryservice.ShareMethodHandshake), resource.TestCheckResourceAttr(resourceName, "notes", "There were hints and allegations"), - resource.TestCheckResourceAttrPair(resourceName, "owner_account_id", "data.aws_caller_identity.current", names.AttrAccountID), + resource.TestCheckResourceAttrPair(resourceName, names.AttrOwnerAccountID, "data.aws_caller_identity.current", names.AttrAccountID), resource.TestCheckResourceAttrSet(resourceName, "owner_directory_id"), resource.TestCheckResourceAttrSet(resourceName, "shared_directory_id"), ), diff --git a/internal/service/ec2/ebs_volume.go b/internal/service/ec2/ebs_volume.go index 2cc71ab1052..8f97d4b2b40 100644 --- a/internal/service/ec2/ebs_volume.go +++ b/internal/service/ec2/ebs_volume.go @@ -110,7 +110,7 @@ func ResourceEBSVolume() *schema.Resource { }, names.AttrTags: tftags.TagsSchema(), names.AttrTagsAll: tftags.TagsSchemaComputed(), - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Optional: true, Computed: true, @@ -163,7 +163,7 @@ func resourceEBSVolumeCreate(ctx context.Context, d *schema.ResourceData, meta i input.SnapshotId = aws.String(value.(string)) } - if value, ok := d.GetOk("throughput"); ok { + if value, ok := d.GetOk(names.AttrThroughput); ok { input.Throughput = aws.Int32(int32(value.(int))) } @@ -218,7 +218,7 @@ func resourceEBSVolumeRead(ctx context.Context, d *schema.ResourceData, meta int d.Set("outpost_arn", volume.OutpostArn) d.Set(names.AttrSize, volume.Size) d.Set(names.AttrSnapshotID, volume.SnapshotId) - d.Set("throughput", volume.Throughput) + d.Set(names.AttrThroughput, volume.Throughput) d.Set(names.AttrType, volume.VolumeType) setTagsOutV2(ctx, volume.Tags) @@ -246,7 +246,7 @@ func resourceEBSVolumeUpdate(ctx context.Context, d *schema.ResourceData, meta i // "If no throughput value is specified, the existing value is retained." // Not currently correct, so always specify any non-zero throughput value. // Throughput is valid only for gp3 volumes. - if v := d.Get("throughput").(int); v > 0 && d.Get(names.AttrType).(string) == string(awstypes.VolumeTypeGp3) { + if v := d.Get(names.AttrThroughput).(int); v > 0 && d.Get(names.AttrType).(string) == string(awstypes.VolumeTypeGp3) { input.Throughput = aws.Int32(int32(v)) } @@ -339,7 +339,7 @@ func resourceEBSVolumeDelete(ctx context.Context, d *schema.ResourceData, meta i func resourceEBSVolumeCustomizeDiff(_ context.Context, diff *schema.ResourceDiff, meta interface{}) error { iops := diff.Get(names.AttrIOPS).(int) multiAttachEnabled := diff.Get("multi_attach_enabled").(bool) - throughput := diff.Get("throughput").(int) + throughput := diff.Get(names.AttrThroughput).(int) volumeType := awstypes.VolumeType(diff.Get(names.AttrType).(string)) if diff.Id() == "" { diff --git a/internal/service/ec2/ebs_volume_data_source.go b/internal/service/ec2/ebs_volume_data_source.go index 95ab70992d7..a906a3b2ecd 100644 --- a/internal/service/ec2/ebs_volume_data_source.go +++ b/internal/service/ec2/ebs_volume_data_source.go @@ -74,7 +74,7 @@ func DataSourceEBSVolume() *schema.Resource { Computed: true, }, names.AttrTags: tftags.TagsSchemaComputed(), - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Computed: true, }, @@ -149,7 +149,7 @@ func dataSourceEBSVolumeRead(ctx context.Context, d *schema.ResourceData, meta i d.Set("outpost_arn", volume.OutpostArn) d.Set(names.AttrSize, volume.Size) d.Set(names.AttrSnapshotID, volume.SnapshotId) - d.Set("throughput", volume.Throughput) + d.Set(names.AttrThroughput, volume.Throughput) d.Set("volume_id", volume.VolumeId) d.Set(names.AttrVolumeType, volume.VolumeType) diff --git a/internal/service/ec2/ebs_volume_data_source_test.go b/internal/service/ec2/ebs_volume_data_source_test.go index e12f2a69d1d..082e425f5b9 100644 --- a/internal/service/ec2/ebs_volume_data_source_test.go +++ b/internal/service/ec2/ebs_volume_data_source_test.go @@ -34,7 +34,7 @@ func TestAccEC2EBSVolumeDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, names.AttrTags, resourceName, names.AttrTags), resource.TestCheckResourceAttrPair(dataSourceName, "outpost_arn", resourceName, "outpost_arn"), resource.TestCheckResourceAttrPair(dataSourceName, "multi_attach_enabled", resourceName, "multi_attach_enabled"), - resource.TestCheckResourceAttrPair(dataSourceName, "throughput", resourceName, "throughput"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrThroughput, resourceName, names.AttrThroughput), ), }, }, diff --git a/internal/service/ec2/ebs_volume_test.go b/internal/service/ec2/ebs_volume_test.go index 370972f7b9e..130ad1fe014 100644 --- a/internal/service/ec2/ebs_volume_test.go +++ b/internal/service/ec2/ebs_volume_test.go @@ -45,7 +45,7 @@ func TestAccEC2EBSVolume_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "outpost_arn", ""), resource.TestCheckResourceAttr(resourceName, names.AttrSize, acctest.Ct1), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct0), - resource.TestCheckResourceAttr(resourceName, "throughput", acctest.Ct0), + resource.TestCheckResourceAttr(resourceName, names.AttrThroughput, acctest.Ct0), resource.TestCheckResourceAttr(resourceName, names.AttrType, "gp2"), ), }, @@ -99,7 +99,7 @@ func TestAccEC2EBSVolume_updateAttachedEBSVolume(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVolumeExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, names.AttrSize, acctest.Ct10), - resource.TestCheckResourceAttr(resourceName, "throughput", acctest.Ct0), + resource.TestCheckResourceAttr(resourceName, names.AttrThroughput, acctest.Ct0), ), }, { @@ -113,7 +113,7 @@ func TestAccEC2EBSVolume_updateAttachedEBSVolume(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVolumeExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, names.AttrSize, "20"), - resource.TestCheckResourceAttr(resourceName, "throughput", acctest.Ct0), + resource.TestCheckResourceAttr(resourceName, names.AttrThroughput, acctest.Ct0), ), }, }, @@ -137,7 +137,7 @@ func TestAccEC2EBSVolume_updateSize(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVolumeExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, names.AttrSize, acctest.Ct1), - resource.TestCheckResourceAttr(resourceName, "throughput", acctest.Ct0), + resource.TestCheckResourceAttr(resourceName, names.AttrThroughput, acctest.Ct0), ), }, { @@ -151,7 +151,7 @@ func TestAccEC2EBSVolume_updateSize(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVolumeExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, names.AttrSize, acctest.Ct10), - resource.TestCheckResourceAttr(resourceName, "throughput", acctest.Ct0), + resource.TestCheckResourceAttr(resourceName, names.AttrThroughput, acctest.Ct0), ), }, }, @@ -175,7 +175,7 @@ func TestAccEC2EBSVolume_updateType(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVolumeExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, names.AttrType, "gp2"), - resource.TestCheckResourceAttr(resourceName, "throughput", acctest.Ct0), + resource.TestCheckResourceAttr(resourceName, names.AttrThroughput, acctest.Ct0), ), }, { @@ -189,7 +189,7 @@ func TestAccEC2EBSVolume_updateType(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVolumeExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, names.AttrType, "sc1"), - resource.TestCheckResourceAttr(resourceName, "throughput", acctest.Ct0), + resource.TestCheckResourceAttr(resourceName, names.AttrThroughput, acctest.Ct0), ), }, }, @@ -213,7 +213,7 @@ func TestAccEC2EBSVolume_UpdateIops_io1(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVolumeExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, names.AttrIOPS, "100"), - resource.TestCheckResourceAttr(resourceName, "throughput", acctest.Ct0), + resource.TestCheckResourceAttr(resourceName, names.AttrThroughput, acctest.Ct0), ), }, { @@ -227,7 +227,7 @@ func TestAccEC2EBSVolume_UpdateIops_io1(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVolumeExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, names.AttrIOPS, "200"), - resource.TestCheckResourceAttr(resourceName, "throughput", acctest.Ct0), + resource.TestCheckResourceAttr(resourceName, names.AttrThroughput, acctest.Ct0), ), }, }, @@ -251,7 +251,7 @@ func TestAccEC2EBSVolume_UpdateIops_io2(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVolumeExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, names.AttrIOPS, "100"), - resource.TestCheckResourceAttr(resourceName, "throughput", acctest.Ct0), + resource.TestCheckResourceAttr(resourceName, names.AttrThroughput, acctest.Ct0), ), }, { @@ -265,7 +265,7 @@ func TestAccEC2EBSVolume_UpdateIops_io2(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVolumeExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, names.AttrIOPS, "200"), - resource.TestCheckResourceAttr(resourceName, "throughput", acctest.Ct0), + resource.TestCheckResourceAttr(resourceName, names.AttrThroughput, acctest.Ct0), ), }, }, @@ -291,7 +291,7 @@ func TestAccEC2EBSVolume_kmsKey(t *testing.T) { testAccCheckVolumeExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, names.AttrEncrypted, acctest.CtTrue), resource.TestCheckResourceAttrPair(resourceName, names.AttrKMSKeyID, kmsKeyResourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "throughput", acctest.Ct0), + resource.TestCheckResourceAttr(resourceName, names.AttrThroughput, acctest.Ct0), ), }, { @@ -320,7 +320,7 @@ func TestAccEC2EBSVolume_noIops(t *testing.T) { Config: testAccEBSVolumeConfig_noIOPS(rName), Check: resource.ComposeTestCheckFunc( testAccCheckVolumeExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "throughput", acctest.Ct0), + resource.TestCheckResourceAttr(resourceName, names.AttrThroughput, acctest.Ct0), ), }, { @@ -429,7 +429,7 @@ func TestAccEC2EBSVolume_multiAttach_io1(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVolumeExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "multi_attach_enabled", acctest.CtTrue), - resource.TestCheckResourceAttr(resourceName, "throughput", acctest.Ct0), + resource.TestCheckResourceAttr(resourceName, names.AttrThroughput, acctest.Ct0), resource.TestCheckResourceAttr(resourceName, names.AttrType, "io1"), ), }, @@ -460,7 +460,7 @@ func TestAccEC2EBSVolume_multiAttach_io2(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVolumeExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "multi_attach_enabled", acctest.CtTrue), - resource.TestCheckResourceAttr(resourceName, "throughput", acctest.Ct0), + resource.TestCheckResourceAttr(resourceName, names.AttrThroughput, acctest.Ct0), resource.TestCheckResourceAttr(resourceName, names.AttrType, "io2"), ), }, @@ -546,7 +546,7 @@ func TestAccEC2EBSVolume_GP3_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrSnapshotID, ""), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "tags.Name", rName), - resource.TestCheckResourceAttr(resourceName, "throughput", "125"), + resource.TestCheckResourceAttr(resourceName, names.AttrThroughput, "125"), resource.TestCheckResourceAttr(resourceName, names.AttrType, "gp3"), ), }, @@ -586,7 +586,7 @@ func TestAccEC2EBSVolume_GP3_iops(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrSnapshotID, ""), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "tags.Name", rName), - resource.TestCheckResourceAttr(resourceName, "throughput", "200"), + resource.TestCheckResourceAttr(resourceName, names.AttrThroughput, "200"), resource.TestCheckResourceAttr(resourceName, names.AttrType, "gp3"), ), }, @@ -610,7 +610,7 @@ func TestAccEC2EBSVolume_GP3_iops(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrSnapshotID, ""), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "tags.Name", rName), - resource.TestCheckResourceAttr(resourceName, "throughput", "200"), + resource.TestCheckResourceAttr(resourceName, names.AttrThroughput, "200"), resource.TestCheckResourceAttr(resourceName, names.AttrType, "gp3"), ), }, @@ -644,7 +644,7 @@ func TestAccEC2EBSVolume_GP3_throughput(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrSnapshotID, ""), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "tags.Name", rName), - resource.TestCheckResourceAttr(resourceName, "throughput", "400"), + resource.TestCheckResourceAttr(resourceName, names.AttrThroughput, "400"), resource.TestCheckResourceAttr(resourceName, names.AttrType, "gp3"), ), }, @@ -668,7 +668,7 @@ func TestAccEC2EBSVolume_GP3_throughput(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrSnapshotID, ""), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "tags.Name", rName), - resource.TestCheckResourceAttr(resourceName, "throughput", "600"), + resource.TestCheckResourceAttr(resourceName, names.AttrThroughput, "600"), resource.TestCheckResourceAttr(resourceName, names.AttrType, "gp3"), ), }, @@ -702,7 +702,7 @@ func TestAccEC2EBSVolume_gp3ToGP2(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrSnapshotID, ""), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "tags.Name", rName), - resource.TestCheckResourceAttr(resourceName, "throughput", "400"), + resource.TestCheckResourceAttr(resourceName, names.AttrThroughput, "400"), resource.TestCheckResourceAttr(resourceName, names.AttrType, "gp3"), ), }, @@ -726,7 +726,7 @@ func TestAccEC2EBSVolume_gp3ToGP2(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrSnapshotID, ""), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "tags.Name", rName), - resource.TestCheckResourceAttr(resourceName, "throughput", acctest.Ct0), + resource.TestCheckResourceAttr(resourceName, names.AttrThroughput, acctest.Ct0), resource.TestCheckResourceAttr(resourceName, names.AttrType, "gp2"), ), }, @@ -760,7 +760,7 @@ func TestAccEC2EBSVolume_io1ToGP3(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrSnapshotID, ""), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "tags.Name", rName), - resource.TestCheckResourceAttr(resourceName, "throughput", acctest.Ct0), + resource.TestCheckResourceAttr(resourceName, names.AttrThroughput, acctest.Ct0), resource.TestCheckResourceAttr(resourceName, names.AttrType, "io1"), ), }, @@ -784,7 +784,7 @@ func TestAccEC2EBSVolume_io1ToGP3(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrSnapshotID, ""), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "tags.Name", rName), - resource.TestCheckResourceAttr(resourceName, "throughput", "125"), + resource.TestCheckResourceAttr(resourceName, names.AttrThroughput, "125"), resource.TestCheckResourceAttr(resourceName, names.AttrType, "gp3"), ), }, @@ -819,7 +819,7 @@ func TestAccEC2EBSVolume_snapshotID(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, names.AttrSnapshotID, snapshotResourceName, names.AttrID), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "tags.Name", rName), - resource.TestCheckResourceAttr(resourceName, "throughput", acctest.Ct0), + resource.TestCheckResourceAttr(resourceName, names.AttrThroughput, acctest.Ct0), resource.TestCheckResourceAttr(resourceName, names.AttrType, "gp2"), ), }, @@ -860,7 +860,7 @@ func TestAccEC2EBSVolume_snapshotIDAndSize(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, names.AttrSnapshotID, snapshotResourceName, names.AttrID), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "tags.Name", rName), - resource.TestCheckResourceAttr(resourceName, "throughput", acctest.Ct0), + resource.TestCheckResourceAttr(resourceName, names.AttrThroughput, acctest.Ct0), resource.TestCheckResourceAttr(resourceName, names.AttrType, "gp2"), ), }, diff --git a/internal/service/ec2/ec2_ami.go b/internal/service/ec2/ec2_ami.go index 52e541e1366..ed2ddc36daf 100644 --- a/internal/service/ec2/ec2_ami.go +++ b/internal/service/ec2/ec2_ami.go @@ -129,7 +129,7 @@ func ResourceAMI() *schema.Resource { Optional: true, ForceNew: true, }, - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Optional: true, Computed: true, @@ -629,7 +629,7 @@ func expandBlockDeviceMappingForAMIEBSBlockDevice(tfMap map[string]interface{}) apiObject.Ebs.Encrypted = aws.Bool(v) } - if v, ok := tfMap["throughput"].(int); ok && v != 0 { + if v, ok := tfMap[names.AttrThroughput].(int); ok && v != 0 { apiObject.Ebs.Throughput = aws.Int64(int64(v)) } @@ -706,7 +706,7 @@ func flattenBlockDeviceMappingForAMIEBSBlockDevice(apiObject *ec2.BlockDeviceMap } if v := apiObject.Ebs.Throughput; v != nil { - tfMap["throughput"] = aws.Int64Value(v) + tfMap[names.AttrThroughput] = aws.Int64Value(v) } if v := apiObject.Ebs.VolumeSize; v != nil { diff --git a/internal/service/ec2/ec2_ami_copy.go b/internal/service/ec2/ec2_ami_copy.go index 0135f703496..b3a49687d85 100644 --- a/internal/service/ec2/ec2_ami_copy.go +++ b/internal/service/ec2/ec2_ami_copy.go @@ -106,7 +106,7 @@ func ResourceAMICopy() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Computed: true, }, diff --git a/internal/service/ec2/ec2_ami_data_source.go b/internal/service/ec2/ec2_ami_data_source.go index 01b56c4fd41..42416170033 100644 --- a/internal/service/ec2/ec2_ami_data_source.go +++ b/internal/service/ec2/ec2_ami_data_source.go @@ -364,7 +364,7 @@ func flattenAMIBlockDeviceMappings(m []*ec2.BlockDeviceMapping) *schema.Set { names.AttrDeleteOnTermination: fmt.Sprintf("%t", aws.BoolValue(v.Ebs.DeleteOnTermination)), names.AttrEncrypted: fmt.Sprintf("%t", aws.BoolValue(v.Ebs.Encrypted)), names.AttrIOPS: fmt.Sprintf("%d", aws.Int64Value(v.Ebs.Iops)), - "throughput": fmt.Sprintf("%d", aws.Int64Value(v.Ebs.Throughput)), + names.AttrThroughput: fmt.Sprintf("%d", aws.Int64Value(v.Ebs.Throughput)), names.AttrVolumeSize: fmt.Sprintf("%d", aws.Int64Value(v.Ebs.VolumeSize)), names.AttrSnapshotID: aws.StringValue(v.Ebs.SnapshotId), names.AttrVolumeType: aws.StringValue(v.Ebs.VolumeType), diff --git a/internal/service/ec2/ec2_ami_from_instance.go b/internal/service/ec2/ec2_ami_from_instance.go index 8bf504344ac..a2ab9355272 100644 --- a/internal/service/ec2/ec2_ami_from_instance.go +++ b/internal/service/ec2/ec2_ami_from_instance.go @@ -100,7 +100,7 @@ func ResourceAMIFromInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Computed: true, }, diff --git a/internal/service/ec2/ec2_ami_test.go b/internal/service/ec2/ec2_ami_test.go index 486481f5315..d9a14a3846b 100644 --- a/internal/service/ec2/ec2_ami_test.go +++ b/internal/service/ec2/ec2_ami_test.go @@ -47,7 +47,7 @@ func TestAccEC2AMI_basic(t *testing.T) { names.AttrDeviceName: "/dev/sda1", names.AttrEncrypted: acctest.CtFalse, names.AttrIOPS: acctest.Ct0, - "throughput": acctest.Ct0, + names.AttrThroughput: acctest.Ct0, names.AttrVolumeSize: "8", "outpost_arn": "", names.AttrVolumeType: "standard", @@ -245,7 +245,7 @@ func TestAccEC2AMI_ephemeralBlockDevices(t *testing.T) { names.AttrDeviceName: "/dev/sda1", names.AttrEncrypted: acctest.CtFalse, names.AttrIOPS: acctest.Ct0, - "throughput": acctest.Ct0, + names.AttrThroughput: acctest.Ct0, names.AttrVolumeSize: "8", "outpost_arn": "", names.AttrVolumeType: "standard", @@ -309,7 +309,7 @@ func TestAccEC2AMI_gp3BlockDevice(t *testing.T) { names.AttrDeviceName: "/dev/sda1", names.AttrEncrypted: acctest.CtFalse, names.AttrIOPS: acctest.Ct0, - "throughput": acctest.Ct0, + names.AttrThroughput: acctest.Ct0, names.AttrVolumeSize: "8", "outpost_arn": "", names.AttrVolumeType: "standard", @@ -320,7 +320,7 @@ func TestAccEC2AMI_gp3BlockDevice(t *testing.T) { names.AttrDeviceName: "/dev/sdb", names.AttrEncrypted: acctest.CtTrue, names.AttrIOPS: "100", - "throughput": "500", + names.AttrThroughput: "500", names.AttrVolumeSize: acctest.Ct10, "outpost_arn": "", names.AttrVolumeType: "gp3", diff --git a/internal/service/ec2/ec2_instance.go b/internal/service/ec2/ec2_instance.go index 9ef3d8f4bef..7b944a387ed 100644 --- a/internal/service/ec2/ec2_instance.go +++ b/internal/service/ec2/ec2_instance.go @@ -268,7 +268,7 @@ func ResourceInstance() *schema.Resource { }, names.AttrTags: tagsSchemaConflictsWith([]string{"volume_tags"}), names.AttrTagsAll: tftags.TagsSchemaComputed(), - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Optional: true, Computed: true, @@ -722,7 +722,7 @@ func ResourceInstance() *schema.Resource { }, names.AttrTags: tagsSchemaConflictsWith([]string{"volume_tags"}), names.AttrTagsAll: tftags.TagsSchemaComputed(), - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Optional: true, Computed: true, @@ -2348,7 +2348,7 @@ func readBlockDevicesFromInstance(ctx context.Context, d *schema.ResourceData, m bd[names.AttrKMSKeyID] = aws.StringValue(vol.KmsKeyId) } if vol.Throughput != nil { - bd["throughput"] = aws.Int64Value(vol.Throughput) + bd[names.AttrThroughput] = aws.Int64Value(vol.Throughput) } if instanceBd.DeviceName != nil { bd[names.AttrDeviceName] = aws.StringValue(instanceBd.DeviceName) @@ -2586,7 +2586,7 @@ func readBlockDeviceMappingsFromConfig(ctx context.Context, d *schema.ResourceDa return nil, fmt.Errorf("creating resource: iops attribute not supported for ebs_block_device with volume_type %s", v) } } - if throughput, ok := bd["throughput"].(int); ok && throughput > 0 { + if throughput, ok := bd[names.AttrThroughput].(int); ok && throughput > 0 { // `throughput` is only valid for gp3 if ec2.VolumeTypeGp3 == strings.ToLower(v) { ebs.Throughput = aws.Int64(int64(throughput)) @@ -2661,7 +2661,7 @@ func readBlockDeviceMappingsFromConfig(ctx context.Context, d *schema.ResourceDa return nil, fmt.Errorf("creating resource: iops attribute not supported for root_block_device with volume_type %s", v) } } - if throughput, ok := bd["throughput"].(int); ok && throughput > 0 { + if throughput, ok := bd[names.AttrThroughput].(int); ok && throughput > 0 { // throughput is only valid for gp3 if ec2.VolumeTypeGp3 == strings.ToLower(v) { ebs.Throughput = aws.Int64(int64(throughput)) diff --git a/internal/service/ec2/ec2_instance_data_source.go b/internal/service/ec2/ec2_instance_data_source.go index e37ed363aa1..65a6918e8f9 100644 --- a/internal/service/ec2/ec2_instance_data_source.go +++ b/internal/service/ec2/ec2_instance_data_source.go @@ -100,7 +100,7 @@ func DataSourceInstance() *schema.Resource { Computed: true, }, names.AttrTags: tftags.TagsSchemaComputed(), - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Computed: true, }, @@ -338,7 +338,7 @@ func DataSourceInstance() *schema.Resource { Computed: true, }, names.AttrTags: tftags.TagsSchemaComputed(), - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Computed: true, }, diff --git a/internal/service/ec2/ec2_instance_test.go b/internal/service/ec2/ec2_instance_test.go index b517c3eb353..8340a9f58b6 100644 --- a/internal/service/ec2/ec2_instance_test.go +++ b/internal/service/ec2/ec2_instance_test.go @@ -806,13 +806,13 @@ func TestAccEC2Instance_blockDevices(t *testing.T) { names.AttrDeviceName: "/dev/sdf", names.AttrVolumeSize: acctest.Ct10, names.AttrVolumeType: "gp3", - "throughput": "300", + names.AttrThroughput: "300", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ names.AttrDeviceName: "/dev/sdg", names.AttrVolumeSize: acctest.Ct10, names.AttrVolumeType: "gp3", - "throughput": "300", + names.AttrThroughput: "300", names.AttrIOPS: "4000", }), resource.TestMatchTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]*regexp.Regexp{ diff --git a/internal/service/ec2/ec2_launch_template.go b/internal/service/ec2/ec2_launch_template.go index fcfad5f9f51..8403419bc6d 100644 --- a/internal/service/ec2/ec2_launch_template.go +++ b/internal/service/ec2/ec2_launch_template.go @@ -89,7 +89,7 @@ func ResourceLaunchTemplate() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Computed: true, Optional: true, @@ -1393,7 +1393,7 @@ func expandLaunchTemplateEBSBlockDeviceRequest(tfMap map[string]interface{}) *ec apiObject.SnapshotId = aws.String(v) } - if v, ok := tfMap["throughput"].(int); ok && v != 0 { + if v, ok := tfMap[names.AttrThroughput].(int); ok && v != 0 { apiObject.Throughput = aws.Int64(int64(v)) } @@ -2415,7 +2415,7 @@ func flattenLaunchTemplateEBSBlockDevice(apiObject *ec2.LaunchTemplateEbsBlockDe } if v := apiObject.Throughput; v != nil { - tfMap["throughput"] = aws.Int64Value(v) + tfMap[names.AttrThroughput] = aws.Int64Value(v) } if v := apiObject.VolumeSize; v != nil { diff --git a/internal/service/ec2/ec2_launch_template_data_source.go b/internal/service/ec2/ec2_launch_template_data_source.go index 92e7ad69bdc..9907e867775 100644 --- a/internal/service/ec2/ec2_launch_template_data_source.go +++ b/internal/service/ec2/ec2_launch_template_data_source.go @@ -69,7 +69,7 @@ func DataSourceLaunchTemplate() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Computed: true, }, diff --git a/internal/service/ec2/ec2_spot_fleet_request.go b/internal/service/ec2/ec2_spot_fleet_request.go index 2d493ebc3b1..9c17b9d7614 100644 --- a/internal/service/ec2/ec2_spot_fleet_request.go +++ b/internal/service/ec2/ec2_spot_fleet_request.go @@ -172,7 +172,7 @@ func ResourceSpotFleetRequest() *schema.Resource { Computed: true, ForceNew: true, }, - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Optional: true, Computed: true, @@ -296,7 +296,7 @@ func ResourceSpotFleetRequest() *schema.Resource { Computed: true, ForceNew: true, }, - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Optional: true, Computed: true, @@ -1368,7 +1368,7 @@ func readSpotFleetBlockDeviceMappingsFromConfig(ctx context.Context, d map[strin ebs.Iops = aws.Int64(int64(v)) } - if v, ok := bd["throughput"].(int); ok && v > 0 { + if v, ok := bd[names.AttrThroughput].(int); ok && v > 0 { ebs.Throughput = aws.Int64(int64(v)) } @@ -1421,7 +1421,7 @@ func readSpotFleetBlockDeviceMappingsFromConfig(ctx context.Context, d map[strin ebs.Iops = aws.Int64(int64(v)) } - if v, ok := bd["throughput"].(int); ok && v > 0 { + if v, ok := bd[names.AttrThroughput].(int); ok && v > 0 { ebs.Throughput = aws.Int64(int64(v)) } @@ -2004,7 +2004,7 @@ func ebsBlockDevicesToSet(bdm []*ec2.BlockDeviceMapping, rootDevName *string) *s } if ebs.Throughput != nil { - m["throughput"] = aws.Int64Value(ebs.Throughput) + m[names.AttrThroughput] = aws.Int64Value(ebs.Throughput) } set.Add(m) @@ -2065,7 +2065,7 @@ func rootBlockDeviceToSet(bdm []*ec2.BlockDeviceMapping, rootDevName *string) *s } if val.Ebs.Throughput != nil { - m["throughput"] = aws.Int64Value(val.Ebs.Throughput) + m[names.AttrThroughput] = aws.Int64Value(val.Ebs.Throughput) } set.Add(m) diff --git a/internal/service/ec2/ec2_spot_fleet_request_test.go b/internal/service/ec2/ec2_spot_fleet_request_test.go index 3503bd7117e..62cd85d8dcb 100644 --- a/internal/service/ec2/ec2_spot_fleet_request_test.go +++ b/internal/service/ec2/ec2_spot_fleet_request_test.go @@ -1412,7 +1412,7 @@ func TestAccEC2SpotFleetRequest_LaunchSpecification_ebsBlockDeviceGP3(t *testing resource.TestCheckTypeSetElemNestedAttrs(resourceName, "launch_specification.*.ebs_block_device.*", map[string]string{ names.AttrDeviceName: "/dev/xvdcz", names.AttrIOPS: "4000", - "throughput": "500", + names.AttrThroughput: "500", names.AttrVolumeSize: "15", names.AttrVolumeType: "gp3", }), @@ -1451,7 +1451,7 @@ func TestAccEC2SpotFleetRequest_LaunchSpecification_rootBlockDeviceGP3(t *testin testAccCheckSpotFleetRequestExists(ctx, resourceName, &config), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "launch_specification.*.root_block_device.*", map[string]string{ names.AttrIOPS: "4000", - "throughput": "500", + names.AttrThroughput: "500", names.AttrVolumeSize: "15", names.AttrVolumeType: "gp3", }), diff --git a/internal/service/ec2/ipam_pool_cidr_allocation.go b/internal/service/ec2/ipam_pool_cidr_allocation.go index f297d916478..cd7a718d2c0 100644 --- a/internal/service/ec2/ipam_pool_cidr_allocation.go +++ b/internal/service/ec2/ipam_pool_cidr_allocation.go @@ -85,7 +85,7 @@ func resourceIPAMPoolCIDRAllocation() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "resource_owner": { + names.AttrResourceOwner: { Type: schema.TypeString, Computed: true, }, @@ -169,7 +169,7 @@ func resourceIPAMPoolCIDRAllocationRead(ctx context.Context, d *schema.ResourceD d.Set("ipam_pool_allocation_id", allocation.IpamPoolAllocationId) d.Set("ipam_pool_id", poolID) d.Set(names.AttrResourceID, allocation.ResourceId) - d.Set("resource_owner", allocation.ResourceOwner) + d.Set(names.AttrResourceOwner, allocation.ResourceOwner) d.Set(names.AttrResourceType, allocation.ResourceType) return diags diff --git a/internal/service/ecs/service.go b/internal/service/ecs/service.go index 075efa7cb70..e3533137d1d 100644 --- a/internal/service/ecs/service.go +++ b/internal/service/ecs/service.go @@ -566,7 +566,7 @@ func ResourceService() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "throughput": { + names.AttrThroughput: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.IntBetween(0, 1000), @@ -1588,7 +1588,7 @@ func expandManagedEBSVolume(ebs []interface{}) *ecs.ServiceManagedEBSVolumeConfi if v, ok := raw[names.AttrSnapshotID].(string); ok && v != "" { config.SnapshotId = aws.String(v) } - if v, ok := raw["throughput"].(int); ok && v != 0 { + if v, ok := raw[names.AttrThroughput].(int); ok && v != 0 { config.Throughput = aws.Int64(int64(v)) } if v, ok := raw[names.AttrVolumeType].(string); ok && v != "" { diff --git a/internal/service/elasticache/cluster.go b/internal/service/elasticache/cluster.go index a0795b5e506..5a9655e58a5 100644 --- a/internal/service/elasticache/cluster.go +++ b/internal/service/elasticache/cluster.go @@ -134,12 +134,12 @@ func resourceCluster() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, - ExactlyOneOf: []string{"engine", "replication_group_id"}, + ExactlyOneOf: []string{names.AttrEngine, "replication_group_id"}, ValidateFunc: validation.StringInSlice(engine_Values(), false), }, names.AttrEngineVersion: { @@ -228,7 +228,7 @@ func resourceCluster() *schema.Resource { RequiredWith: []string{"preferred_outpost_arn"}, ValidateFunc: validation.StringInSlice(elasticache.OutpostMode_Values(), false), }, - "parameter_group_name": { + names.AttrParameterGroupName: { Type: schema.TypeString, Optional: true, Computed: true, @@ -263,7 +263,7 @@ func resourceCluster() *schema.Resource { Optional: true, Computed: true, ForceNew: true, - ExactlyOneOf: []string{"replication_group_id", "engine"}, + ExactlyOneOf: []string{"replication_group_id", names.AttrEngine}, ValidateFunc: validateReplicationGroupID, ConflictsWith: []string{ "az_mode", @@ -272,7 +272,7 @@ func resourceCluster() *schema.Resource { "node_type", "notification_topic_arn", "num_cache_nodes", - "parameter_group_name", + names.AttrParameterGroupName, names.AttrPort, names.AttrSecurityGroupIDs, "snapshot_arns", @@ -377,7 +377,7 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, meta int input.PreferredOutpostArn = aws.String(v.(string)) } - if v, ok := d.GetOk("engine"); ok { + if v, ok := d.GetOk(names.AttrEngine); ok { input.Engine = aws.String(v.(string)) } @@ -401,7 +401,7 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, meta int } // parameter groups are optional and can be defaulted by AWS - if v, ok := d.GetOk("parameter_group_name"); ok { + if v, ok := d.GetOk(names.AttrParameterGroupName); ok { input.CacheParameterGroupName = aws.String(v.(string)) } @@ -578,8 +578,8 @@ func resourceClusterUpdate(ctx context.Context, d *schema.ResourceData, meta int } } - if d.HasChange("parameter_group_name") { - input.CacheParameterGroupName = aws.String(d.Get("parameter_group_name").(string)) + if d.HasChange(names.AttrParameterGroupName) { + input.CacheParameterGroupName = aws.String(d.Get(names.AttrParameterGroupName).(string)) requestUpdate = true } @@ -971,7 +971,7 @@ func (b byCacheNodeId) Less(i, j int) bool { func setFromCacheCluster(d *schema.ResourceData, c *elasticache.CacheCluster) error { d.Set("node_type", c.CacheNodeType) - d.Set("engine", c.Engine) + d.Set(names.AttrEngine, c.Engine) if aws.StringValue(c.Engine) == engineRedis { if err := setEngineVersionRedis(d, c.EngineVersion); err != nil { return err // nosemgrep:ci.bare-error-returns @@ -987,7 +987,7 @@ func setFromCacheCluster(d *schema.ResourceData, c *elasticache.CacheCluster) er } if c.CacheParameterGroup != nil { - d.Set("parameter_group_name", c.CacheParameterGroup.CacheParameterGroupName) + d.Set(names.AttrParameterGroupName, c.CacheParameterGroup.CacheParameterGroupName) } d.Set("maintenance_window", c.PreferredMaintenanceWindow) diff --git a/internal/service/elasticache/cluster_data_source.go b/internal/service/elasticache/cluster_data_source.go index cad284acbfe..b95f8540ce6 100644 --- a/internal/service/elasticache/cluster_data_source.go +++ b/internal/service/elasticache/cluster_data_source.go @@ -78,7 +78,7 @@ func dataSourceCluster() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Computed: true, }, @@ -134,7 +134,7 @@ func dataSourceCluster() *schema.Resource { Type: schema.TypeInt, Computed: true, }, - "parameter_group_name": { + names.AttrParameterGroupName: { Type: schema.TypeString, Computed: true, }, @@ -194,7 +194,7 @@ func dataSourceClusterRead(ctx context.Context, d *schema.ResourceData, meta int d.Set(names.AttrPort, port) } d.Set("cluster_id", cluster.CacheClusterId) - d.Set("engine", cluster.Engine) + d.Set(names.AttrEngine, cluster.Engine) d.Set(names.AttrEngineVersion, cluster.EngineVersion) d.Set("ip_discovery", cluster.IpDiscovery) d.Set("log_delivery_configuration", flattenLogDeliveryConfigurations(cluster.LogDeliveryConfigurations)) @@ -208,7 +208,7 @@ func dataSourceClusterRead(ctx context.Context, d *schema.ResourceData, meta int } d.Set("num_cache_nodes", cluster.NumCacheNodes) if cluster.CacheParameterGroup != nil { - d.Set("parameter_group_name", cluster.CacheParameterGroup.CacheParameterGroupName) + d.Set(names.AttrParameterGroupName, cluster.CacheParameterGroup.CacheParameterGroupName) } d.Set("preferred_outpost_arn", cluster.PreferredOutpostArn) d.Set("replication_group_id", cluster.ReplicationGroupId) diff --git a/internal/service/elasticache/cluster_data_source_test.go b/internal/service/elasticache/cluster_data_source_test.go index 89b776793a6..eaaf6552172 100644 --- a/internal/service/elasticache/cluster_data_source_test.go +++ b/internal/service/elasticache/cluster_data_source_test.go @@ -35,7 +35,7 @@ func TestAccElastiCacheClusterDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, names.AttrAvailabilityZone, resourceName, names.AttrAvailabilityZone), resource.TestCheckResourceAttrPair(dataSourceName, "cluster_address", resourceName, "cluster_address"), resource.TestCheckResourceAttrPair(dataSourceName, "configuration_endpoint", resourceName, "configuration_endpoint"), - resource.TestCheckResourceAttrPair(dataSourceName, "engine", resourceName, "engine"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEngine, resourceName, names.AttrEngine), resource.TestCheckResourceAttrPair(dataSourceName, "ip_discovery", resourceName, "ip_discovery"), resource.TestCheckResourceAttrPair(dataSourceName, "network_type", resourceName, "network_type"), resource.TestCheckResourceAttrPair(dataSourceName, "node_type", resourceName, "node_type"), @@ -65,7 +65,7 @@ func TestAccElastiCacheClusterDataSource_Engine_Redis_LogDeliveryConfigurations( { Config: testAccClusterConfig_dataSourceEngineRedisLogDeliveryConfigurations(rName, true, elasticache.DestinationTypeKinesisFirehose, elasticache.LogFormatJson, true, elasticache.DestinationTypeCloudwatchLogs, elasticache.LogFormatText), Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr(dataSourceName, "engine", "redis"), + resource.TestCheckResourceAttr(dataSourceName, names.AttrEngine, "redis"), resource.TestCheckResourceAttr(dataSourceName, "log_delivery_configuration.#", acctest.Ct2), resource.TestCheckResourceAttr(dataSourceName, "log_delivery_configuration.0.destination", rName), resource.TestCheckResourceAttr(dataSourceName, "log_delivery_configuration.0.destination_type", "cloudwatch-logs"), diff --git a/internal/service/elasticache/cluster_test.go b/internal/service/elasticache/cluster_test.go index 791d7ca1666..ddae636fa8d 100644 --- a/internal/service/elasticache/cluster_test.go +++ b/internal/service/elasticache/cluster_test.go @@ -57,7 +57,7 @@ func TestAccElastiCacheCluster_Engine_memcached(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "cache_nodes.0.id", "0001"), resource.TestCheckResourceAttrSet(resourceName, "configuration_endpoint"), resource.TestCheckResourceAttrSet(resourceName, "cluster_address"), - resource.TestCheckResourceAttr(resourceName, "engine", "memcached"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "memcached"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "11211"), ), }, @@ -97,7 +97,7 @@ func TestAccElastiCacheCluster_Engine_redis(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "cache_nodes.#", acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "cache_nodes.0.id", "0001"), resource.TestCheckResourceAttr(resourceName, "cache_nodes.0.outpost_arn", ""), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), resource.TestMatchResourceAttr(resourceName, "engine_version_actual", regexache.MustCompile(`^7\.[[:digit:]]+\.[[:digit:]]+$`)), resource.TestCheckResourceAttr(resourceName, "ip_discovery", "ipv4"), resource.TestCheckResourceAttr(resourceName, "network_type", "ipv4"), @@ -165,7 +165,7 @@ func TestAccElastiCacheCluster_Engine_redis_v5(t *testing.T) { Config: testAccClusterConfig_engineRedisV5(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &ec), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), resource.TestCheckResourceAttr(resourceName, "engine_version_actual", "5.0.6"), // Even though it is ignored, the API returns `true` in this case resource.TestCheckResourceAttr(resourceName, names.AttrAutoMinorVersionUpgrade, acctest.CtTrue), @@ -250,10 +250,10 @@ func TestAccElastiCacheCluster_ParameterGroupName_default(t *testing.T) { Config: testAccClusterConfig_parameterGroupName(rName, "memcached", "1.4.34", "default.memcached1.4"), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &ec), - resource.TestCheckResourceAttr(resourceName, "engine", "memcached"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "memcached"), resource.TestCheckResourceAttr(resourceName, names.AttrEngineVersion, "1.4.34"), resource.TestCheckResourceAttr(resourceName, "engine_version_actual", "1.4.34"), - resource.TestCheckResourceAttr(resourceName, "parameter_group_name", "default.memcached1.4"), + resource.TestCheckResourceAttr(resourceName, names.AttrParameterGroupName, "default.memcached1.4"), ), }, { @@ -328,7 +328,7 @@ func TestAccElastiCacheCluster_port(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "cache_nodes.0.id", "0001"), resource.TestCheckResourceAttrSet(resourceName, "configuration_endpoint"), resource.TestCheckResourceAttrSet(resourceName, "cluster_address"), - resource.TestCheckResourceAttr(resourceName, "engine", "memcached"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "memcached"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, strconv.Itoa(port)), ), }, @@ -905,7 +905,7 @@ func TestAccElastiCacheCluster_ReplicationGroupID_singleReplica(t *testing.T) { testAccCheckReplicationGroupExists(ctx, replicationGroupResourceName, &replicationGroup), testAccCheckClusterExists(ctx, clusterResourceName, &cluster), testAccCheckClusterReplicationGroupIDAttribute(&cluster, &replicationGroup), - resource.TestCheckResourceAttr(clusterResourceName, "engine", "redis"), + resource.TestCheckResourceAttr(clusterResourceName, names.AttrEngine, "redis"), resource.TestCheckResourceAttr(clusterResourceName, "node_type", "cache.t3.medium"), resource.TestCheckResourceAttr(clusterResourceName, names.AttrPort, "6379"), ), @@ -940,13 +940,13 @@ func TestAccElastiCacheCluster_ReplicationGroupID_multipleReplica(t *testing.T) testAccCheckClusterExists(ctx, clusterResourceName1, &cluster1), testAccCheckClusterReplicationGroupIDAttribute(&cluster1, &replicationGroup), - resource.TestCheckResourceAttr(clusterResourceName1, "engine", "redis"), + resource.TestCheckResourceAttr(clusterResourceName1, names.AttrEngine, "redis"), resource.TestCheckResourceAttr(clusterResourceName1, "node_type", "cache.t3.medium"), resource.TestCheckResourceAttr(clusterResourceName1, names.AttrPort, "6379"), testAccCheckClusterExists(ctx, clusterResourceName2, &cluster2), testAccCheckClusterReplicationGroupIDAttribute(&cluster2, &replicationGroup), - resource.TestCheckResourceAttr(clusterResourceName2, "engine", "redis"), + resource.TestCheckResourceAttr(clusterResourceName2, names.AttrEngine, "redis"), resource.TestCheckResourceAttr(clusterResourceName2, "node_type", "cache.t3.medium"), resource.TestCheckResourceAttr(clusterResourceName2, names.AttrPort, "6379"), ), @@ -1062,7 +1062,7 @@ func TestAccElastiCacheCluster_Engine_Redis_LogDeliveryConfigurations(t *testing Config: testAccClusterConfig_dataSourceEngineRedisLogDeliveryConfigurations(rName, true, elasticache.DestinationTypeCloudwatchLogs, elasticache.LogFormatText, true, elasticache.DestinationTypeCloudwatchLogs, elasticache.LogFormatText), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &ec), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.destination", rName), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.destination_type", "cloudwatch-logs"), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.log_format", "text"), @@ -1083,7 +1083,7 @@ func TestAccElastiCacheCluster_Engine_Redis_LogDeliveryConfigurations(t *testing Config: testAccClusterConfig_dataSourceEngineRedisLogDeliveryConfigurations(rName, true, elasticache.DestinationTypeKinesisFirehose, elasticache.LogFormatJson, true, elasticache.DestinationTypeKinesisFirehose, elasticache.LogFormatJson), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &ec), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.destination", rName), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.destination_type", "kinesis-firehose"), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.log_format", names.AttrJSON), @@ -1104,7 +1104,7 @@ func TestAccElastiCacheCluster_Engine_Redis_LogDeliveryConfigurations(t *testing Config: testAccClusterConfig_dataSourceEngineRedisLogDeliveryConfigurations(rName, true, elasticache.DestinationTypeCloudwatchLogs, elasticache.LogFormatText, true, elasticache.DestinationTypeKinesisFirehose, elasticache.LogFormatJson), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &ec), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.destination", rName), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.destination_type", "cloudwatch-logs"), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.log_format", "text"), @@ -1119,7 +1119,7 @@ func TestAccElastiCacheCluster_Engine_Redis_LogDeliveryConfigurations(t *testing Config: testAccClusterConfig_dataSourceEngineRedisLogDeliveryConfigurations(rName, true, elasticache.DestinationTypeKinesisFirehose, elasticache.LogFormatJson, true, elasticache.DestinationTypeCloudwatchLogs, elasticache.LogFormatText), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &ec), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.destination", rName), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.destination_type", "cloudwatch-logs"), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.log_format", "text"), @@ -1134,7 +1134,7 @@ func TestAccElastiCacheCluster_Engine_Redis_LogDeliveryConfigurations(t *testing Config: testAccClusterConfig_dataSourceEngineRedisLogDeliveryConfigurations(rName, false, "", "", false, "", ""), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &ec), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), resource.TestCheckNoResourceAttr(resourceName, "log_delivery_configuration.0.destination"), resource.TestCheckNoResourceAttr(resourceName, "log_delivery_configuration.0.destination_type"), resource.TestCheckNoResourceAttr(resourceName, "log_delivery_configuration.0.log_format"), @@ -1149,7 +1149,7 @@ func TestAccElastiCacheCluster_Engine_Redis_LogDeliveryConfigurations(t *testing Config: testAccClusterConfig_dataSourceEngineRedisLogDeliveryConfigurations(rName, true, elasticache.DestinationTypeKinesisFirehose, elasticache.LogFormatJson, false, "", ""), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &ec), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.destination", rName), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.destination_type", "kinesis-firehose"), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.log_format", names.AttrJSON), @@ -1297,7 +1297,7 @@ func TestAccElastiCacheCluster_TransitEncryption(t *testing.T) { Config: testAccClusterConfig_transitEncryption(rName, "memcached", "1.6.12"), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &cluster), - resource.TestCheckResourceAttr(resourceName, "engine", "memcached"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "memcached"), resource.TestCheckResourceAttr(resourceName, names.AttrEngineVersion, "1.6.12"), resource.TestCheckResourceAttr(resourceName, "transit_encryption_enabled", acctest.CtTrue), ), @@ -1330,7 +1330,7 @@ func TestAccElastiCacheCluster_outpost_memcached(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "cache_nodes.0.outpost_arn"), resource.TestCheckResourceAttrSet(resourceName, "configuration_endpoint"), resource.TestCheckResourceAttrSet(resourceName, "cluster_address"), - resource.TestCheckResourceAttr(resourceName, "engine", "memcached"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "memcached"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "11211"), ), }, @@ -1368,7 +1368,7 @@ func TestAccElastiCacheCluster_outpost_redis(t *testing.T) { testAccCheckClusterExists(ctx, resourceName, &ec), resource.TestCheckResourceAttr(resourceName, "cache_nodes.0.id", "0001"), resource.TestCheckResourceAttrSet(resourceName, "cache_nodes.0.outpost_arn"), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), resource.TestMatchResourceAttr(resourceName, "engine_version_actual", regexache.MustCompile(`^7\.[[:digit:]]+\.[[:digit:]]+$`)), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "6379"), resource.TestCheckResourceAttr(resourceName, names.AttrAutoMinorVersionUpgrade, acctest.CtTrue), diff --git a/internal/service/elasticache/diff.go b/internal/service/elasticache/diff.go index 1c815e71e07..dd262aec52f 100644 --- a/internal/service/elasticache/diff.go +++ b/internal/service/elasticache/diff.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go/service/elasticache" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-aws/names" ) // customizeDiffValidateClusterAZMode validates that `num_cache_nodes` is greater than 1 when `az_mode` is "cross-az" @@ -25,7 +26,7 @@ func customizeDiffValidateClusterAZMode(_ context.Context, diff *schema.Resource // customizeDiffValidateClusterNumCacheNodes validates that `num_cache_nodes` is 1 when `engine` is "redis" func customizeDiffValidateClusterNumCacheNodes(_ context.Context, diff *schema.ResourceDiff, v interface{}) error { - if v, ok := diff.GetOk("engine"); !ok || v.(string) == engineMemcached { + if v, ok := diff.GetOk(names.AttrEngine); !ok || v.(string) == engineMemcached { return nil } @@ -42,7 +43,7 @@ func customizeDiffClusterMemcachedNodeType(_ context.Context, diff *schema.Resou if diff.Id() == "" || !diff.HasChange("node_type") { return nil } - if v, ok := diff.GetOk("engine"); !ok || v.(string) == engineRedis { + if v, ok := diff.GetOk(names.AttrEngine); !ok || v.(string) == engineRedis { return nil } return diff.ForceNew("node_type") @@ -50,7 +51,7 @@ func customizeDiffClusterMemcachedNodeType(_ context.Context, diff *schema.Resou // customizeDiffValidateClusterMemcachedSnapshotIdentifier validates that `final_snapshot_identifier` is not set when `engine` is "memcached" func customizeDiffValidateClusterMemcachedSnapshotIdentifier(_ context.Context, diff *schema.ResourceDiff, v interface{}) error { - if v, ok := diff.GetOk("engine"); !ok || v.(string) == engineRedis { + if v, ok := diff.GetOk(names.AttrEngine); !ok || v.(string) == engineRedis { return nil } if _, ok := diff.GetOk("final_snapshot_identifier"); !ok { diff --git a/internal/service/elasticache/engine_version.go b/internal/service/elasticache/engine_version.go index 27371ea8316..71b0bd817b0 100644 --- a/internal/service/elasticache/engine_version.go +++ b/internal/service/elasticache/engine_version.go @@ -63,7 +63,7 @@ func customizeDiffValidateClusterEngineVersion(_ context.Context, diff *schema.R return nil } - return validateClusterEngineVersion(diff.Get("engine").(string), engineVersion.(string)) + return validateClusterEngineVersion(diff.Get(names.AttrEngine).(string), engineVersion.(string)) } // validateClusterEngineVersion validates the correct format for `engine_version`, based on `engine` diff --git a/internal/service/elasticache/engine_version_test.go b/internal/service/elasticache/engine_version_test.go index ca0217331c8..0af633bb794 100644 --- a/internal/service/elasticache/engine_version_test.go +++ b/internal/service/elasticache/engine_version_test.go @@ -879,7 +879,7 @@ func TestParamGroupNameRequiresMajorVersionUpgrade(t *testing.T) { diff := &mockChangesDiffer{ values: map[string]mockDiff{ - "parameter_group_name": { + names.AttrParameterGroupName: { old: testcase.paramOld, new: testcase.paramNew, hasChange: testcase.paramHasChange, diff --git a/internal/service/elasticache/global_replication_group.go b/internal/service/elasticache/global_replication_group.go index 3dee8479c1c..fe284d944d5 100644 --- a/internal/service/elasticache/global_replication_group.go +++ b/internal/service/elasticache/global_replication_group.go @@ -88,7 +88,7 @@ func resourceGlobalReplicationGroup() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Computed: true, }, @@ -182,7 +182,7 @@ func resourceGlobalReplicationGroup() *schema.Resource { Optional: true, ValidateFunc: validation.IntAtLeast(1), }, - "parameter_group_name": { + names.AttrParameterGroupName: { Type: schema.TypeString, Optional: true, }, @@ -236,7 +236,7 @@ func customizeDiffGlobalReplicationGroupParamGroupNameRequiresMajorVersionUpgrad // parameter_group_name can only be set when doing a major update, // but we also should allow it to stay set afterwards func paramGroupNameRequiresMajorVersionUpgrade(diff sdkv2.ResourceDiffer) error { - o, n := diff.GetChange("parameter_group_name") + o, n := diff.GetChange(names.AttrParameterGroupName) if o.(string) == n.(string) { return nil } @@ -328,7 +328,7 @@ func resourceGlobalReplicationGroupCreate(ctx context.Context, d *schema.Resourc return sdkdiag.AppendErrorf(diags, "updating ElastiCache Global Replication Group (%s) engine version on creation: cannot downgrade version when creating, is %s, want %s", d.Id(), engineVersion.String(), requestedVersion.String()) } - p := d.Get("parameter_group_name").(string) + p := d.Get(names.AttrParameterGroupName).(string) if diff[0] == 1 { if err := updateGlobalReplicationGroup(ctx, conn, d.Id(), globalReplicationGroupEngineVersionMajorUpdater(v.(string), p), "engine version (major)", d.Timeout(schema.TimeoutCreate)); err != nil { @@ -393,7 +393,7 @@ func resourceGlobalReplicationGroupRead(ctx context.Context, d *schema.ResourceD d.Set("auth_token_enabled", globalReplicationGroup.AuthTokenEnabled) d.Set("cache_node_type", globalReplicationGroup.CacheNodeType) d.Set("cluster_enabled", globalReplicationGroup.ClusterEnabled) - d.Set("engine", globalReplicationGroup.Engine) + d.Set(names.AttrEngine, globalReplicationGroup.Engine) d.Set("global_replication_group_description", globalReplicationGroup.GlobalReplicationGroupDescription) d.Set("global_replication_group_id", globalReplicationGroup.GlobalReplicationGroupId) d.Set("transit_encryption_enabled", globalReplicationGroup.TransitEncryptionEnabled) @@ -438,7 +438,7 @@ func resourceGlobalReplicationGroupUpdate(ctx context.Context, d *schema.Resourc diff := diffVersion(newVersion, oldVersion) if diff[0] == 1 { - p := d.Get("parameter_group_name").(string) + p := d.Get(names.AttrParameterGroupName).(string) if err := updateGlobalReplicationGroup(ctx, conn, d.Id(), globalReplicationGroupEngineVersionMajorUpdater(n.(string), p), "engine version (major)", d.Timeout(schema.TimeoutUpdate)); err != nil { return sdkdiag.AppendFromErr(diags, err) } diff --git a/internal/service/elasticache/global_replication_group_test.go b/internal/service/elasticache/global_replication_group_test.go index 4a73b0355c7..e5cdce7df59 100644 --- a/internal/service/elasticache/global_replication_group_test.go +++ b/internal/service/elasticache/global_replication_group_test.go @@ -57,7 +57,7 @@ func TestAccElastiCacheGlobalReplicationGroup_basic(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "automatic_failover_enabled", primaryReplicationGroupResourceName, "automatic_failover_enabled"), resource.TestCheckResourceAttrPair(resourceName, "cache_node_type", primaryReplicationGroupResourceName, "node_type"), resource.TestCheckResourceAttrPair(resourceName, "cluster_enabled", primaryReplicationGroupResourceName, "cluster_enabled"), - resource.TestCheckResourceAttrPair(resourceName, "engine", primaryReplicationGroupResourceName, "engine"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrEngine, primaryReplicationGroupResourceName, names.AttrEngine), resource.TestCheckResourceAttrPair(resourceName, "engine_version_actual", primaryReplicationGroupResourceName, "engine_version_actual"), resource.TestCheckResourceAttr(resourceName, "global_replication_group_id_suffix", rName), resource.TestMatchResourceAttr(resourceName, "global_replication_group_id", regexache.MustCompile(tfelasticache.GlobalReplicationGroupRegionPrefixFormat+rName)), @@ -1016,7 +1016,7 @@ func TestAccElastiCacheGlobalReplicationGroup_SetEngineVersionOnCreate_MajorUpgr ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"parameter_group_name"}, + ImportStateVerifyIgnore: []string{names.AttrParameterGroupName}, }, }, }) @@ -1055,7 +1055,7 @@ func TestAccElastiCacheGlobalReplicationGroup_SetEngineVersionOnCreate_MajorUpgr ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"parameter_group_name"}, + ImportStateVerifyIgnore: []string{names.AttrParameterGroupName}, }, }, }) diff --git a/internal/service/elasticache/replication_group.go b/internal/service/elasticache/replication_group.go index b48b1db4225..a74d9657a19 100644 --- a/internal/service/elasticache/replication_group.go +++ b/internal/service/elasticache/replication_group.go @@ -108,7 +108,7 @@ func resourceReplicationGroup() *schema.Resource { Computed: true, ValidateFunc: validation.StringIsNotEmpty, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -136,8 +136,8 @@ func resourceReplicationGroup() *schema.Resource { Computed: true, ConflictsWith: []string{ "num_node_groups", - "parameter_group_name", - "engine", + names.AttrParameterGroupName, + names.AttrEngine, names.AttrEngineVersion, "node_type", "security_group_names", @@ -236,7 +236,7 @@ func resourceReplicationGroup() *schema.Resource { Computed: true, ConflictsWith: []string{"num_cache_clusters", "global_replication_group_id"}, }, - "parameter_group_name": { + names.AttrParameterGroupName: { Type: schema.TypeString, Optional: true, Computed: true, @@ -442,7 +442,7 @@ func resourceReplicationGroupCreate(ctx context.Context, d *schema.ResourceData, } input.AutomaticFailoverEnabled = aws.Bool(d.Get("automatic_failover_enabled").(bool)) input.CacheNodeType = aws.String(nodeType) - input.Engine = aws.String(d.Get("engine").(string)) + input.Engine = aws.String(d.Get(names.AttrEngine).(string)) } if v, ok := d.GetOk("ip_discovery"); ok { @@ -489,7 +489,7 @@ func resourceReplicationGroupCreate(ctx context.Context, d *schema.ResourceData, input.NumNodeGroups = aws.Int64(int64(v.(int))) } - if v, ok := d.GetOk("parameter_group_name"); ok { + if v, ok := d.GetOk(names.AttrParameterGroupName); ok { input.CacheParameterGroupName = aws.String(v.(string)) } @@ -835,8 +835,8 @@ func resourceReplicationGroupUpdate(ctx context.Context, d *schema.ResourceData, requestUpdate = true } - if d.HasChange("parameter_group_name") { - input.CacheParameterGroupName = aws.String(d.Get("parameter_group_name").(string)) + if d.HasChange(names.AttrParameterGroupName) { + input.CacheParameterGroupName = aws.String(d.Get(names.AttrParameterGroupName).(string)) requestUpdate = true } @@ -995,7 +995,7 @@ func resourceReplicationGroupDelete(ctx context.Context, d *schema.ResourceData, } if hasGlobalReplicationGroupID { - if paramGroupName := d.Get("parameter_group_name").(string); paramGroupName != "" { + if paramGroupName := d.Get(names.AttrParameterGroupName).(string); paramGroupName != "" { if err := deleteParameterGroup(ctx, conn, paramGroupName); err != nil { return sdkdiag.AppendFromErr(diags, err) } diff --git a/internal/service/elasticache/replication_group_migrate.go b/internal/service/elasticache/replication_group_migrate.go index 8509be6bc0a..f32461c7184 100644 --- a/internal/service/elasticache/replication_group_migrate.go +++ b/internal/service/elasticache/replication_group_migrate.go @@ -84,7 +84,7 @@ func resourceReplicationGroupConfigV1() *schema.Resource { Computed: true, ValidateFunc: validation.StringIsNotEmpty, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -108,8 +108,8 @@ func resourceReplicationGroupConfigV1() *schema.Resource { Computed: true, ConflictsWith: []string{ "num_node_groups", - "parameter_group_name", - "engine", + names.AttrParameterGroupName, + names.AttrEngine, names.AttrEngineVersion, "node_type", "security_group_names", @@ -203,7 +203,7 @@ func resourceReplicationGroupConfigV1() *schema.Resource { Computed: true, ConflictsWith: []string{"num_cache_clusters", "global_replication_group_id"}, }, - "parameter_group_name": { + names.AttrParameterGroupName: { Type: schema.TypeString, Optional: true, Computed: true, diff --git a/internal/service/elasticache/replication_group_test.go b/internal/service/elasticache/replication_group_test.go index 79b07dc2589..c039350b05b 100644 --- a/internal/service/elasticache/replication_group_test.go +++ b/internal/service/elasticache/replication_group_test.go @@ -46,7 +46,7 @@ func TestAccElastiCacheReplicationGroup_basic(t *testing.T) { Config: testAccReplicationGroupConfig_basic(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckReplicationGroupExists(ctx, resourceName, &rg), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), acctest.CheckResourceAttrRegionalARN(resourceName, names.AttrARN, "elasticache", fmt.Sprintf("replicationgroup:%s", rName)), resource.TestCheckResourceAttr(resourceName, "num_cache_clusters", acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "multi_az_enabled", acctest.CtFalse), @@ -90,7 +90,7 @@ func TestAccElastiCacheReplicationGroup_basic_v5(t *testing.T) { Config: testAccReplicationGroupConfig_v5(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckReplicationGroupExists(ctx, resourceName, &rg), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), resource.TestCheckResourceAttr(resourceName, names.AttrEngineVersion, "5.0.6"), resource.TestCheckResourceAttr(resourceName, "engine_version_actual", "5.0.6"), // Even though it is ignored, the API returns `true` in this case @@ -160,7 +160,7 @@ func TestAccElastiCacheReplicationGroup_EngineVersion_v7(t *testing.T) { Config: testAccReplicationGroupConfig_v7(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckReplicationGroupExists(ctx, resourceName, &rg), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), resource.TestCheckResourceAttr(resourceName, names.AttrEngineVersion, "7.0"), resource.TestMatchResourceAttr(resourceName, "engine_version_actual", regexache.MustCompile(`^7\.[[:digit:]]+\.[[:digit:]]+$`)), ), @@ -512,7 +512,7 @@ func TestAccElastiCacheReplicationGroup_updateParameterGroup(t *testing.T) { Config: testAccReplicationGroupConfig_parameterName(rName, 0), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckReplicationGroupExists(ctx, resourceName, &rg), - resource.TestCheckResourceAttrPair(resourceName, "parameter_group_name", parameterGroupResourceName1, names.AttrName), + resource.TestCheckResourceAttrPair(resourceName, names.AttrParameterGroupName, parameterGroupResourceName1, names.AttrName), ), }, { @@ -529,7 +529,7 @@ func TestAccElastiCacheReplicationGroup_updateParameterGroup(t *testing.T) { Config: testAccReplicationGroupConfig_parameterName(rName, 1), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckReplicationGroupExists(ctx, resourceName, &rg), - resource.TestCheckResourceAttrPair(resourceName, "parameter_group_name", parameterGroupResourceName2, names.AttrName), + resource.TestCheckResourceAttrPair(resourceName, names.AttrParameterGroupName, parameterGroupResourceName2, names.AttrName), ), }, }, @@ -888,7 +888,7 @@ func TestAccElastiCacheReplicationGroup_ipDiscovery(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "num_node_groups", acctest.Ct2), resource.TestCheckResourceAttr(resourceName, "replicas_per_node_group", acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "num_cache_clusters", acctest.Ct4), - resource.TestCheckResourceAttr(resourceName, "parameter_group_name", "default.redis7.cluster.on"), + resource.TestCheckResourceAttr(resourceName, names.AttrParameterGroupName, "default.redis7.cluster.on"), resource.TestCheckResourceAttr(resourceName, "automatic_failover_enabled", acctest.CtTrue), resource.TestCheckResourceAttr(resourceName, "ip_discovery", "ipv6"), ), @@ -929,7 +929,7 @@ func TestAccElastiCacheReplicationGroup_networkType(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "num_node_groups", acctest.Ct2), resource.TestCheckResourceAttr(resourceName, "replicas_per_node_group", acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "num_cache_clusters", acctest.Ct4), - resource.TestCheckResourceAttr(resourceName, "parameter_group_name", "default.redis7.cluster.on"), + resource.TestCheckResourceAttr(resourceName, names.AttrParameterGroupName, "default.redis7.cluster.on"), resource.TestCheckResourceAttr(resourceName, "automatic_failover_enabled", acctest.CtTrue), resource.TestCheckResourceAttr(resourceName, "ip_discovery", "ipv6"), resource.TestCheckResourceAttr(resourceName, "network_type", "dual_stack"), @@ -1008,7 +1008,7 @@ func TestAccElastiCacheReplicationGroup_ClusterMode_nonClusteredParameterGroup(t Check: resource.ComposeAggregateTestCheckFunc( testAccCheckReplicationGroupExists(ctx, resourceName, &rg), resource.TestCheckResourceAttr(resourceName, "cluster_enabled", acctest.CtFalse), - resource.TestCheckResourceAttr(resourceName, "parameter_group_name", "default.redis6.x"), + resource.TestCheckResourceAttr(resourceName, names.AttrParameterGroupName, "default.redis6.x"), resource.TestCheckResourceAttr(resourceName, "num_node_groups", acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "replicas_per_node_group", acctest.Ct1), resource.TestMatchResourceAttr(resourceName, "primary_endpoint_address", regexache.MustCompile(fmt.Sprintf("%s\\..+\\.%s", rName, acctest.PartitionDNSSuffix()))), @@ -1290,7 +1290,7 @@ func TestAccElastiCacheReplicationGroup_ClusterMode_singleNode(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckReplicationGroupExists(ctx, resourceName, &rg), resource.TestCheckResourceAttr(resourceName, "cluster_enabled", acctest.CtTrue), - resource.TestCheckResourceAttr(resourceName, "parameter_group_name", "default.redis6.x.cluster.on"), + resource.TestCheckResourceAttr(resourceName, names.AttrParameterGroupName, "default.redis6.x.cluster.on"), resource.TestCheckResourceAttr(resourceName, "num_node_groups", acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "replicas_per_node_group", acctest.Ct0), resource.TestCheckResourceAttr(resourceName, "multi_az_enabled", acctest.CtFalse), @@ -2267,9 +2267,9 @@ func TestAccElastiCacheReplicationGroup_GlobalReplicationGroupID_basic(t *testin testAccCheckReplicationGroupParameterGroupExists(ctx, &rg, &pg), resource.TestCheckResourceAttrPair(resourceName, "global_replication_group_id", "aws_elasticache_global_replication_group.test", "global_replication_group_id"), resource.TestCheckResourceAttrPair(resourceName, "node_type", primaryGroupResourceName, "node_type"), - resource.TestCheckResourceAttrPair(resourceName, "engine", primaryGroupResourceName, "engine"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrEngine, primaryGroupResourceName, names.AttrEngine), resource.TestCheckResourceAttrPair(resourceName, names.AttrEngineVersion, primaryGroupResourceName, names.AttrEngineVersion), - resource.TestMatchResourceAttr(resourceName, "parameter_group_name", regexache.MustCompile(fmt.Sprintf("^global-datastore-%s-", rName))), + resource.TestMatchResourceAttr(resourceName, names.AttrParameterGroupName, regexache.MustCompile(fmt.Sprintf("^global-datastore-%s-", rName))), resource.TestCheckResourceAttr(resourceName, "num_cache_clusters", acctest.Ct1), resource.TestCheckResourceAttr(primaryGroupResourceName, "num_cache_clusters", acctest.Ct2), ), @@ -2320,9 +2320,9 @@ func TestAccElastiCacheReplicationGroup_GlobalReplicationGroupID_full(t *testing testAccCheckReplicationGroupParameterGroupExists(ctx, &rg1, &pg1), resource.TestCheckResourceAttrPair(resourceName, "global_replication_group_id", "aws_elasticache_global_replication_group.test", "global_replication_group_id"), resource.TestCheckResourceAttrPair(resourceName, "node_type", primaryGroupResourceName, "node_type"), - resource.TestCheckResourceAttrPair(resourceName, "engine", primaryGroupResourceName, "engine"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrEngine, primaryGroupResourceName, names.AttrEngine), resource.TestCheckResourceAttrPair(resourceName, names.AttrEngineVersion, primaryGroupResourceName, names.AttrEngineVersion), - resource.TestMatchResourceAttr(resourceName, "parameter_group_name", regexache.MustCompile(fmt.Sprintf("^global-datastore-%s-", rName))), + resource.TestMatchResourceAttr(resourceName, names.AttrParameterGroupName, regexache.MustCompile(fmt.Sprintf("^global-datastore-%s-", rName))), resource.TestCheckResourceAttr(resourceName, "num_cache_clusters", strconv.Itoa(initialNumCacheClusters)), resource.TestCheckResourceAttrPair(resourceName, "multi_az_enabled", primaryGroupResourceName, "multi_az_enabled"), @@ -2419,7 +2419,7 @@ func TestAccElastiCacheReplicationGroup_GlobalReplicationGroupIDClusterMode_basi resource.TestCheckResourceAttr(resourceName, "num_node_groups", acctest.Ct2), resource.TestCheckResourceAttr(resourceName, "replicas_per_node_group", acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "automatic_failover_enabled", acctest.CtTrue), - resource.TestMatchResourceAttr(resourceName, "parameter_group_name", regexache.MustCompile(fmt.Sprintf("^global-datastore-%s-", rName))), + resource.TestMatchResourceAttr(resourceName, names.AttrParameterGroupName, regexache.MustCompile(fmt.Sprintf("^global-datastore-%s-", rName))), resource.TestCheckResourceAttr(primaryGroupResourceName, "num_node_groups", acctest.Ct2), resource.TestCheckResourceAttr(primaryGroupResourceName, "replicas_per_node_group", acctest.Ct2), @@ -2497,7 +2497,7 @@ func TestAccElastiCacheReplicationGroup_dataTiering(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckReplicationGroupExists(ctx, resourceName, &rg), testCheckRedisEngineVersionLatest(ctx, &version), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), func(s *terraform.State) error { return resource.TestCheckResourceAttr(resourceName, names.AttrEngineVersion, *version.EngineVersion)(s) }, @@ -2534,7 +2534,7 @@ func TestAccElastiCacheReplicationGroup_Engine_Redis_LogDeliveryConfigurations_C Config: testAccReplicationGroupConfig_dataSourceEngineRedisLogDeliveryConfigurations(rName, false, true, elasticache.DestinationTypeCloudwatchLogs, elasticache.LogFormatText, true, elasticache.DestinationTypeCloudwatchLogs, elasticache.LogFormatText), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckReplicationGroupExists(ctx, resourceName, &rg), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), resource.TestCheckResourceAttr(resourceName, "cluster_enabled", acctest.CtFalse), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.destination", rName), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.destination_type", "cloudwatch-logs"), @@ -2560,7 +2560,7 @@ func TestAccElastiCacheReplicationGroup_Engine_Redis_LogDeliveryConfigurations_C Config: testAccReplicationGroupConfig_dataSourceEngineRedisLogDeliveryConfigurations(rName, false, true, elasticache.DestinationTypeCloudwatchLogs, elasticache.LogFormatText, true, elasticache.DestinationTypeKinesisFirehose, elasticache.LogFormatJson), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckReplicationGroupExists(ctx, resourceName, &rg), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), resource.TestCheckResourceAttr(resourceName, "cluster_enabled", acctest.CtFalse), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.destination", rName), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.destination_type", "cloudwatch-logs"), @@ -2576,7 +2576,7 @@ func TestAccElastiCacheReplicationGroup_Engine_Redis_LogDeliveryConfigurations_C Config: testAccReplicationGroupConfig_dataSourceEngineRedisLogDeliveryConfigurations(rName, false, true, elasticache.DestinationTypeKinesisFirehose, elasticache.LogFormatJson, false, "", ""), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckReplicationGroupExists(ctx, resourceName, &rg), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.destination", rName), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.destination_type", "kinesis-firehose"), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.log_format", names.AttrJSON), @@ -2591,7 +2591,7 @@ func TestAccElastiCacheReplicationGroup_Engine_Redis_LogDeliveryConfigurations_C Config: testAccReplicationGroupConfig_dataSourceEngineRedisLogDeliveryConfigurations(rName, false, false, "", "", false, "", ""), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckReplicationGroupExists(ctx, resourceName, &rg), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), resource.TestCheckResourceAttr(resourceName, "cluster_enabled", acctest.CtFalse), resource.TestCheckNoResourceAttr(resourceName, "log_delivery_configuration.0.destination"), resource.TestCheckNoResourceAttr(resourceName, "log_delivery_configuration.0.destination_type"), @@ -2637,9 +2637,9 @@ func TestAccElastiCacheReplicationGroup_Engine_Redis_LogDeliveryConfigurations_C Config: testAccReplicationGroupConfig_dataSourceEngineRedisLogDeliveryConfigurations(rName, true, true, elasticache.DestinationTypeCloudwatchLogs, elasticache.LogFormatText, true, elasticache.DestinationTypeCloudwatchLogs, elasticache.LogFormatText), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckReplicationGroupExists(ctx, resourceName, &rg), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), resource.TestCheckResourceAttr(resourceName, "cluster_enabled", acctest.CtTrue), - resource.TestCheckResourceAttr(resourceName, "parameter_group_name", "default.redis6.x.cluster.on"), + resource.TestCheckResourceAttr(resourceName, names.AttrParameterGroupName, "default.redis6.x.cluster.on"), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.destination", rName), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.destination_type", "cloudwatch-logs"), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.log_format", "text"), @@ -2664,9 +2664,9 @@ func TestAccElastiCacheReplicationGroup_Engine_Redis_LogDeliveryConfigurations_C Config: testAccReplicationGroupConfig_dataSourceEngineRedisLogDeliveryConfigurations(rName, true, true, elasticache.DestinationTypeCloudwatchLogs, elasticache.LogFormatText, true, elasticache.DestinationTypeKinesisFirehose, elasticache.LogFormatJson), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckReplicationGroupExists(ctx, resourceName, &rg), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), resource.TestCheckResourceAttr(resourceName, "cluster_enabled", acctest.CtTrue), - resource.TestCheckResourceAttr(resourceName, "parameter_group_name", "default.redis6.x.cluster.on"), + resource.TestCheckResourceAttr(resourceName, names.AttrParameterGroupName, "default.redis6.x.cluster.on"), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.destination", rName), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.destination_type", "cloudwatch-logs"), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.log_format", "text"), @@ -2681,9 +2681,9 @@ func TestAccElastiCacheReplicationGroup_Engine_Redis_LogDeliveryConfigurations_C Config: testAccReplicationGroupConfig_dataSourceEngineRedisLogDeliveryConfigurations(rName, true, true, elasticache.DestinationTypeKinesisFirehose, elasticache.LogFormatJson, false, "", ""), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckReplicationGroupExists(ctx, resourceName, &rg), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), resource.TestCheckResourceAttr(resourceName, "cluster_enabled", acctest.CtTrue), - resource.TestCheckResourceAttr(resourceName, "parameter_group_name", "default.redis6.x.cluster.on"), + resource.TestCheckResourceAttr(resourceName, names.AttrParameterGroupName, "default.redis6.x.cluster.on"), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.destination", rName), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.destination_type", "kinesis-firehose"), resource.TestCheckResourceAttr(resourceName, "log_delivery_configuration.0.log_format", names.AttrJSON), @@ -2698,7 +2698,7 @@ func TestAccElastiCacheReplicationGroup_Engine_Redis_LogDeliveryConfigurations_C Config: testAccReplicationGroupConfig_dataSourceEngineRedisLogDeliveryConfigurations(rName, true, false, "", "", false, "", ""), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckReplicationGroupExists(ctx, resourceName, &rg), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), resource.TestCheckResourceAttr(resourceName, "cluster_enabled", acctest.CtTrue), resource.TestCheckNoResourceAttr(resourceName, "log_delivery_configuration.0.destination"), resource.TestCheckNoResourceAttr(resourceName, "log_delivery_configuration.0.destination_type"), @@ -2877,7 +2877,7 @@ func testCheckEngineStuffDefault(ctx context.Context, resourceName string) resou return resource.TestMatchResourceAttr(resourceName, "engine_version_actual", regexache.MustCompile(fmt.Sprintf(`^%s\.[[:digit:]]+$`, *version.EngineVersion)))(s) }, func(s *terraform.State) error { - return resource.TestCheckResourceAttr(resourceName, "parameter_group_name", *parameterGroup.CacheParameterGroupName)(s) + return resource.TestCheckResourceAttr(resourceName, names.AttrParameterGroupName, *parameterGroup.CacheParameterGroupName)(s) }, } @@ -2948,7 +2948,7 @@ func testCheckEngineStuffClusterEnabledDefault(ctx context.Context, resourceName return resource.TestMatchResourceAttr(resourceName, "engine_version_actual", regexache.MustCompile(fmt.Sprintf(`^%s\.[[:digit:]]+$`, *version.EngineVersion)))(s) }, func(s *terraform.State) error { - return resource.TestCheckResourceAttr(resourceName, "parameter_group_name", *parameterGroup.CacheParameterGroupName)(s) + return resource.TestCheckResourceAttr(resourceName, names.AttrParameterGroupName, *parameterGroup.CacheParameterGroupName)(s) }, } diff --git a/internal/service/elasticache/serverless_cache.go b/internal/service/elasticache/serverless_cache.go index 2e81227cb23..5de88df8118 100644 --- a/internal/service/elasticache/serverless_cache.go +++ b/internal/service/elasticache/serverless_cache.go @@ -91,7 +91,7 @@ func (r *serverlessCacheResource) Schema(ctx context.Context, request resource.S listplanmodifier.UseStateForUnknown(), }, }, - "engine": schema.StringAttribute{ + names.AttrEngine: schema.StringAttribute{ Required: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.RequiresReplace(), diff --git a/internal/service/elasticache/serverless_cache_test.go b/internal/service/elasticache/serverless_cache_test.go index 4b7b27dca14..a8bdb9a6b24 100644 --- a/internal/service/elasticache/serverless_cache_test.go +++ b/internal/service/elasticache/serverless_cache_test.go @@ -45,7 +45,7 @@ func TestAccElastiCacheServerlessCache_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "cache_usage_limits.#"), resource.TestCheckResourceAttrSet(resourceName, names.AttrCreateTime), resource.TestCheckResourceAttrSet(resourceName, "endpoint.#"), - resource.TestCheckResourceAttrSet(resourceName, "engine"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEngine), resource.TestCheckResourceAttrSet(resourceName, "full_engine_version"), resource.TestCheckResourceAttrSet(resourceName, "reader_endpoint.#"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), @@ -89,7 +89,7 @@ func TestAccElastiCacheServerlessCache_basicRedis(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, names.AttrCreateTime), resource.TestCheckResourceAttrSet(resourceName, "daily_snapshot_time"), resource.TestCheckResourceAttrSet(resourceName, "endpoint.#"), - resource.TestCheckResourceAttrSet(resourceName, "engine"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEngine), resource.TestCheckResourceAttrSet(resourceName, "full_engine_version"), resource.TestCheckResourceAttrSet(resourceName, "reader_endpoint.#"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), @@ -137,7 +137,7 @@ func TestAccElastiCacheServerlessCache_full(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "cache_usage_limits.0.ecpu_per_second.0.minimum", "1000"), resource.TestCheckResourceAttrSet(resourceName, names.AttrCreateTime), resource.TestCheckResourceAttrSet(resourceName, "endpoint.#"), - resource.TestCheckResourceAttrSet(resourceName, "engine"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEngine), resource.TestCheckResourceAttrSet(resourceName, "full_engine_version"), resource.TestCheckResourceAttrSet(resourceName, "reader_endpoint.#"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), @@ -180,7 +180,7 @@ func TestAccElastiCacheServerlessCache_fullRedis(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "cache_usage_limits.#"), resource.TestCheckResourceAttrSet(resourceName, names.AttrCreateTime), resource.TestCheckResourceAttrSet(resourceName, "endpoint.#"), - resource.TestCheckResourceAttrSet(resourceName, "engine"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEngine), resource.TestCheckResourceAttrSet(resourceName, "full_engine_version"), resource.TestCheckResourceAttrSet(resourceName, "reader_endpoint.#"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), @@ -226,7 +226,7 @@ func TestAccElastiCacheServerlessCache_update(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, names.AttrCreateTime), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, descriptionOld), resource.TestCheckResourceAttrSet(resourceName, "endpoint.#"), - resource.TestCheckResourceAttrSet(resourceName, "engine"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEngine), resource.TestCheckResourceAttrSet(resourceName, "full_engine_version"), resource.TestCheckResourceAttrSet(resourceName, "reader_endpoint.#"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), @@ -248,7 +248,7 @@ func TestAccElastiCacheServerlessCache_update(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, names.AttrCreateTime), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, descriptionNew), resource.TestCheckResourceAttrSet(resourceName, "endpoint.#"), - resource.TestCheckResourceAttrSet(resourceName, "engine"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEngine), resource.TestCheckResourceAttrSet(resourceName, "full_engine_version"), resource.TestCheckResourceAttrSet(resourceName, "reader_endpoint.#"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), @@ -289,7 +289,7 @@ func TestAccElastiCacheServerlessCache_updatesc(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, names.AttrCreateTime), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, descriptionOld), resource.TestCheckResourceAttrSet(resourceName, "endpoint.#"), - resource.TestCheckResourceAttrSet(resourceName, "engine"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEngine), resource.TestCheckResourceAttrSet(resourceName, "full_engine_version"), resource.TestCheckResourceAttrSet(resourceName, "reader_endpoint.#"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), @@ -311,7 +311,7 @@ func TestAccElastiCacheServerlessCache_updatesc(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, names.AttrCreateTime), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, descriptionNew), resource.TestCheckResourceAttrSet(resourceName, "endpoint.#"), - resource.TestCheckResourceAttrSet(resourceName, "engine"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEngine), resource.TestCheckResourceAttrSet(resourceName, "full_engine_version"), resource.TestCheckResourceAttrSet(resourceName, "reader_endpoint.#"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), diff --git a/internal/service/elasticache/user.go b/internal/service/elasticache/user.go index 5dee7a68fd1..63bfc16cd24 100644 --- a/internal/service/elasticache/user.go +++ b/internal/service/elasticache/user.go @@ -86,7 +86,7 @@ func resourceUser() *schema.Resource { }, }, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -133,7 +133,7 @@ func resourceUserCreate(ctx context.Context, d *schema.ResourceData, meta interf userID := d.Get("user_id").(string) input := &elasticache.CreateUserInput{ AccessString: aws.String(d.Get("access_string").(string)), - Engine: aws.String(d.Get("engine").(string)), + Engine: aws.String(d.Get(names.AttrEngine).(string)), NoPasswordRequired: aws.Bool(d.Get("no_password_required").(bool)), Tags: getTagsIn(ctx), UserId: aws.String(userID), @@ -217,7 +217,7 @@ func resourceUserRead(ctx context.Context, d *schema.ResourceData, meta interfac } else { d.Set("authentication_mode", nil) } - d.Set("engine", user.Engine) + d.Set(names.AttrEngine, user.Engine) d.Set("user_id", user.UserId) d.Set(names.AttrUserName, user.UserName) diff --git a/internal/service/elasticache/user_data_source.go b/internal/service/elasticache/user_data_source.go index 9e6fc71e039..e5be202ddea 100644 --- a/internal/service/elasticache/user_data_source.go +++ b/internal/service/elasticache/user_data_source.go @@ -41,7 +41,7 @@ func dataSourceUser() *schema.Resource { }, }, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Optional: true, }, @@ -90,7 +90,7 @@ func dataSourceUserRead(ctx context.Context, d *schema.ResourceData, meta interf return sdkdiag.AppendErrorf(diags, "setting authentication_mode: %s", err) } } - d.Set("engine", user.Engine) + d.Set(names.AttrEngine, user.Engine) d.Set("user_id", user.UserId) d.Set(names.AttrUserName, user.UserName) diff --git a/internal/service/elasticache/user_data_source_test.go b/internal/service/elasticache/user_data_source_test.go index 62c62b46d7e..6254a013bf0 100644 --- a/internal/service/elasticache/user_data_source_test.go +++ b/internal/service/elasticache/user_data_source_test.go @@ -27,7 +27,7 @@ func TestAccElastiCacheUserDataSource_basic(t *testing.T) { { Config: testAccUserDataSourceConfig_basic(rName), Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttrPair(dataSourceName, "engine", resourceName, "engine"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEngine, resourceName, names.AttrEngine), resource.TestCheckResourceAttrPair(dataSourceName, "user_id", resourceName, "user_id"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrUserName, resourceName, names.AttrUserName), resource.TestCheckResourceAttrPair(dataSourceName, "access_string", resourceName, "access_string"), diff --git a/internal/service/elasticache/user_group.go b/internal/service/elasticache/user_group.go index 1e72030746c..3c7e55f2fb8 100644 --- a/internal/service/elasticache/user_group.go +++ b/internal/service/elasticache/user_group.go @@ -47,7 +47,7 @@ func resourceUserGroup() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -78,7 +78,7 @@ func resourceUserGroupCreate(ctx context.Context, d *schema.ResourceData, meta i userGroupID := d.Get("user_group_id").(string) input := &elasticache.CreateUserGroupInput{ - Engine: aws.String(d.Get("engine").(string)), + Engine: aws.String(d.Get(names.AttrEngine).(string)), Tags: getTagsIn(ctx), UserGroupId: aws.String(userGroupID), } @@ -140,7 +140,7 @@ func resourceUserGroupRead(ctx context.Context, d *schema.ResourceData, meta int } d.Set(names.AttrARN, userGroup.ARN) - d.Set("engine", userGroup.Engine) + d.Set(names.AttrEngine, userGroup.Engine) d.Set("user_ids", aws.StringValueSlice(userGroup.UserIds)) d.Set("user_group_id", userGroup.UserGroupId) diff --git a/internal/service/elasticache/user_group_test.go b/internal/service/elasticache/user_group_test.go index 068342f40e9..16ab296b15b 100644 --- a/internal/service/elasticache/user_group_test.go +++ b/internal/service/elasticache/user_group_test.go @@ -37,7 +37,7 @@ func TestAccElastiCacheUserGroup_basic(t *testing.T) { testAccCheckUserGroupExists(ctx, resourceName, &userGroup), resource.TestCheckResourceAttr(resourceName, "user_ids.#", acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "user_group_id", rName), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), ), }, { @@ -67,7 +67,7 @@ func TestAccElastiCacheUserGroup_update(t *testing.T) { testAccCheckUserGroupExists(ctx, resourceName, &userGroup), resource.TestCheckResourceAttr(resourceName, "user_ids.#", acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "user_group_id", rName), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), ), }, { @@ -76,7 +76,7 @@ func TestAccElastiCacheUserGroup_update(t *testing.T) { testAccCheckUserGroupExists(ctx, resourceName, &userGroup), resource.TestCheckResourceAttr(resourceName, "user_ids.#", acctest.Ct2), resource.TestCheckResourceAttr(resourceName, "user_group_id", rName), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), ), }, { @@ -85,7 +85,7 @@ func TestAccElastiCacheUserGroup_update(t *testing.T) { testAccCheckUserGroupExists(ctx, resourceName, &userGroup), resource.TestCheckResourceAttr(resourceName, "user_ids.#", acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "user_group_id", rName), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), ), }, }, diff --git a/internal/service/elasticache/user_test.go b/internal/service/elasticache/user_test.go index 59651cce0e5..34841293f97 100644 --- a/internal/service/elasticache/user_test.go +++ b/internal/service/elasticache/user_test.go @@ -39,7 +39,7 @@ func TestAccElastiCacheUser_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "user_id", rName), resource.TestCheckResourceAttr(resourceName, "no_password_required", acctest.CtFalse), resource.TestCheckResourceAttr(resourceName, names.AttrUserName, "username1"), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), ), }, { @@ -73,7 +73,7 @@ func TestAccElastiCacheUser_password_auth_mode(t *testing.T) { testAccCheckUserExists(ctx, resourceName, &user), resource.TestCheckResourceAttr(resourceName, "user_id", rName), resource.TestCheckResourceAttr(resourceName, names.AttrUserName, "username1"), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), resource.TestCheckResourceAttr(resourceName, "authentication_mode.0.password_count", acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "authentication_mode.0.passwords.#", acctest.Ct1), resource.TestCheckTypeSetElemAttr(resourceName, "authentication_mode.0.passwords.*", "aaaaaaaaaaaaaaaa"), @@ -112,7 +112,7 @@ func TestAccElastiCacheUser_iam_auth_mode(t *testing.T) { testAccCheckUserExists(ctx, resourceName, &user), resource.TestCheckResourceAttr(resourceName, "user_id", rName), resource.TestCheckResourceAttr(resourceName, names.AttrUserName, rName), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), resource.TestCheckResourceAttr(resourceName, "authentication_mode.0.type", "iam"), ), }, @@ -249,7 +249,7 @@ func TestAccElastiCacheUser_tags(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "user_id", rName), resource.TestCheckResourceAttr(resourceName, "no_password_required", acctest.CtFalse), resource.TestCheckResourceAttr(resourceName, names.AttrUserName, "username1"), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "tags.tagKey", "tagVal"), ), @@ -261,7 +261,7 @@ func TestAccElastiCacheUser_tags(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "user_id", rName), resource.TestCheckResourceAttr(resourceName, "no_password_required", acctest.CtFalse), resource.TestCheckResourceAttr(resourceName, names.AttrUserName, "username1"), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "tags.tagKey", "tagVal2"), ), @@ -273,7 +273,7 @@ func TestAccElastiCacheUser_tags(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "user_id", rName), resource.TestCheckResourceAttr(resourceName, "no_password_required", acctest.CtFalse), resource.TestCheckResourceAttr(resourceName, names.AttrUserName, "username1"), - resource.TestCheckResourceAttr(resourceName, "engine", "redis"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct0), ), }, diff --git a/internal/service/elasticsearch/domain.go b/internal/service/elasticsearch/domain.go index 31ffd969324..db268b2f66c 100644 --- a/internal/service/elasticsearch/domain.go +++ b/internal/service/elasticsearch/domain.go @@ -396,7 +396,7 @@ func ResourceDomain() *schema.Resource { Optional: true, Computed: true, }, - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Optional: true, Computed: true, diff --git a/internal/service/elasticsearch/domain_data_source.go b/internal/service/elasticsearch/domain_data_source.go index fec0ae3e50c..869f9bda418 100644 --- a/internal/service/elasticsearch/domain_data_source.go +++ b/internal/service/elasticsearch/domain_data_source.go @@ -222,7 +222,7 @@ func DataSourceDomain() *schema.Resource { Type: schema.TypeInt, Computed: true, }, - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Computed: true, }, diff --git a/internal/service/elasticsearch/flex.go b/internal/service/elasticsearch/flex.go index d15210505ee..d4c17ec722f 100644 --- a/internal/service/elasticsearch/flex.go +++ b/internal/service/elasticsearch/flex.go @@ -91,7 +91,7 @@ func expandEBSOptions(m map[string]interface{}) *elasticsearch.EBSOptions { if v, ok := m[names.AttrIOPS]; ok && v.(int) > 0 && EBSVolumeTypePermitsIopsInput(volumeType) { options.Iops = aws.Int64(int64(v.(int))) } - if v, ok := m["throughput"]; ok && v.(int) > 0 && EBSVolumeTypePermitsThroughputInput(volumeType) { + if v, ok := m[names.AttrThroughput]; ok && v.(int) > 0 && EBSVolumeTypePermitsThroughputInput(volumeType) { options.Throughput = aws.Int64(int64(v.(int))) } } @@ -178,7 +178,7 @@ func flattenEBSOptions(o *elasticsearch.EBSOptions) []map[string]interface{} { m[names.AttrIOPS] = aws.Int64Value(o.Iops) } if o.Throughput != nil { - m["throughput"] = aws.Int64Value(o.Throughput) + m[names.AttrThroughput] = aws.Int64Value(o.Throughput) } if o.VolumeSize != nil { m[names.AttrVolumeSize] = aws.Int64Value(o.VolumeSize) diff --git a/internal/service/emr/cluster.go b/internal/service/emr/cluster.go index 4d817c3ca85..56894efac3f 100644 --- a/internal/service/emr/cluster.go +++ b/internal/service/emr/cluster.go @@ -362,7 +362,7 @@ func resourceCluster() *schema.Resource { Required: true, ForceNew: true, }, - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Optional: true, ForceNew: true, @@ -588,7 +588,7 @@ func resourceCluster() *schema.Resource { Required: true, ForceNew: true, }, - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Optional: true, ForceNew: true, @@ -1832,7 +1832,7 @@ func flattenEBSConfig(ebsBlockDevices []*emr.EbsBlockDevice) *schema.Set { ebsAttrs[names.AttrSize] = int(aws.Int64Value(ebs.VolumeSpecification.SizeInGB)) } if ebs.VolumeSpecification.Throughput != nil { - ebsAttrs["throughput"] = aws.Int64Value(ebs.VolumeSpecification.Throughput) + ebsAttrs[names.AttrThroughput] = aws.Int64Value(ebs.VolumeSpecification.Throughput) } if ebs.VolumeSpecification.VolumeType != nil { ebsAttrs[names.AttrType] = aws.StringValue(ebs.VolumeSpecification.VolumeType) @@ -1982,7 +1982,7 @@ func expandEBSConfig(configAttributes map[string]interface{}, config *emr.Instan VolumeType: aws.String(rawEbsConfig[names.AttrType].(string)), }, } - if v, ok := rawEbsConfig["throughput"].(int); ok && v != 0 { + if v, ok := rawEbsConfig[names.AttrThroughput].(int); ok && v != 0 { ebsBlockDeviceConfig.VolumeSpecification.Throughput = aws.Int64(int64(v)) } if v, ok := rawEbsConfig[names.AttrIOPS].(int); ok && v != 0 { @@ -2080,7 +2080,7 @@ func resourceClusterEBSHashConfig(v interface{}) int { buf.WriteString(fmt.Sprintf("%d-", m[names.AttrSize].(int))) buf.WriteString(fmt.Sprintf("%s-", m[names.AttrType].(string))) buf.WriteString(fmt.Sprintf("%d-", m["volumes_per_instance"].(int))) - if v, ok := m["throughput"].(int); ok && v != 0 { + if v, ok := m[names.AttrThroughput].(int); ok && v != 0 { buf.WriteString(fmt.Sprintf("%d-", v)) } if v, ok := m[names.AttrIOPS].(int); ok && v != 0 { @@ -2265,7 +2265,7 @@ func expandEBSConfiguration(ebsConfigurations []interface{}) *emr.EbsConfigurati VolumeType: aws.String(cfg[names.AttrType].(string)), }, } - if v, ok := cfg["throughput"].(int); ok && v != 0 { + if v, ok := cfg[names.AttrThroughput].(int); ok && v != 0 { ebsBlockDeviceConfig.VolumeSpecification.Throughput = aws.Int64(int64(v)) } if v, ok := cfg[names.AttrIOPS].(int); ok && v != 0 { diff --git a/internal/service/fsx/ontap_file_system.go b/internal/service/fsx/ontap_file_system.go index 7f395e061f1..a35345599f2 100644 --- a/internal/service/fsx/ontap_file_system.go +++ b/internal/service/fsx/ontap_file_system.go @@ -118,7 +118,7 @@ func resourceONTAPFileSystem() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "ip_addresses": { + names.AttrIPAddresses: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -135,7 +135,7 @@ func resourceONTAPFileSystem() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "ip_addresses": { + names.AttrIPAddresses: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -553,7 +553,7 @@ func flattenOntapFileSystemEndpoint(rs *fsx.FileSystemEndpoint) []interface{} { m[names.AttrDNSName] = aws.StringValue(rs.DNSName) } if rs.IpAddresses != nil { - m["ip_addresses"] = flex.FlattenStringSet(rs.IpAddresses) + m[names.AttrIPAddresses] = flex.FlattenStringSet(rs.IpAddresses) } return []interface{}{m} diff --git a/internal/service/fsx/ontap_file_system_data_source.go b/internal/service/fsx/ontap_file_system_data_source.go index 4f36242d25f..cbbec1ce791 100644 --- a/internal/service/fsx/ontap_file_system_data_source.go +++ b/internal/service/fsx/ontap_file_system_data_source.go @@ -77,7 +77,7 @@ func dataSourceONTAPFileSystem() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "ip_addresses": { + names.AttrIPAddresses: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -94,7 +94,7 @@ func dataSourceONTAPFileSystem() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "ip_addresses": { + names.AttrIPAddresses: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, diff --git a/internal/service/fsx/ontap_storage_virtual_machine.go b/internal/service/fsx/ontap_storage_virtual_machine.go index a9e6c55cdd7..178d2ee4e9f 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine.go +++ b/internal/service/fsx/ontap_storage_virtual_machine.go @@ -135,7 +135,7 @@ func resourceONTAPStorageVirtualMachine() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "ip_addresses": { + names.AttrIPAddresses: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -152,7 +152,7 @@ func resourceONTAPStorageVirtualMachine() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "ip_addresses": { + names.AttrIPAddresses: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -169,7 +169,7 @@ func resourceONTAPStorageVirtualMachine() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "ip_addresses": { + names.AttrIPAddresses: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -186,7 +186,7 @@ func resourceONTAPStorageVirtualMachine() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "ip_addresses": { + names.AttrIPAddresses: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -567,7 +567,7 @@ func flattenSvmEndpoint(rs *fsx.SvmEndpoint) []interface{} { m[names.AttrDNSName] = aws.StringValue(rs.DNSName) } if rs.IpAddresses != nil { - m["ip_addresses"] = flex.FlattenStringSet(rs.IpAddresses) + m[names.AttrIPAddresses] = flex.FlattenStringSet(rs.IpAddresses) } return []interface{}{m} diff --git a/internal/service/fsx/ontap_storage_virtual_machine_data_source.go b/internal/service/fsx/ontap_storage_virtual_machine_data_source.go index 9859eafd20b..d0d0e4a2b1c 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine_data_source.go +++ b/internal/service/fsx/ontap_storage_virtual_machine_data_source.go @@ -88,7 +88,7 @@ func dataSourceONTAPStorageVirtualMachine() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "ip_addresses": { + names.AttrIPAddresses: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -105,7 +105,7 @@ func dataSourceONTAPStorageVirtualMachine() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "ip_addresses": { + names.AttrIPAddresses: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -122,7 +122,7 @@ func dataSourceONTAPStorageVirtualMachine() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "ip_addresses": { + names.AttrIPAddresses: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -139,7 +139,7 @@ func dataSourceONTAPStorageVirtualMachine() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "ip_addresses": { + names.AttrIPAddresses: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, diff --git a/internal/service/fsx/ontap_storage_virtual_machine_migrate.go b/internal/service/fsx/ontap_storage_virtual_machine_migrate.go index 7af906f43a1..22c16c3d75b 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine_migrate.go +++ b/internal/service/fsx/ontap_storage_virtual_machine_migrate.go @@ -111,7 +111,7 @@ func resourceONTAPStorageVirtualMachineV0() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "ip_addresses": { + names.AttrIPAddresses: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -128,7 +128,7 @@ func resourceONTAPStorageVirtualMachineV0() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "ip_addresses": { + names.AttrIPAddresses: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -145,7 +145,7 @@ func resourceONTAPStorageVirtualMachineV0() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "ip_addresses": { + names.AttrIPAddresses: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -162,7 +162,7 @@ func resourceONTAPStorageVirtualMachineV0() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "ip_addresses": { + names.AttrIPAddresses: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, diff --git a/internal/service/globalaccelerator/accelerator.go b/internal/service/globalaccelerator/accelerator.go index 49338a72fb0..9263261d210 100644 --- a/internal/service/globalaccelerator/accelerator.go +++ b/internal/service/globalaccelerator/accelerator.go @@ -95,7 +95,7 @@ func resourceAccelerator() *schema.Resource { Default: awstypes.IpAddressTypeIpv4, ValidateDiagFunc: enum.Validate[awstypes.IpAddressType](), }, - "ip_addresses": { + names.AttrIPAddresses: { Type: schema.TypeList, Optional: true, ForceNew: true, @@ -106,7 +106,7 @@ func resourceAccelerator() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "ip_addresses": { + names.AttrIPAddresses: { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -152,7 +152,7 @@ func resourceAcceleratorCreate(ctx context.Context, d *schema.ResourceData, meta input.IpAddressType = awstypes.IpAddressType(v.(string)) } - if v, ok := d.GetOk("ip_addresses"); ok && len(v.([]interface{})) > 0 { + if v, ok := d.GetOk(names.AttrIPAddresses); ok && len(v.([]interface{})) > 0 { input.IpAddresses = flex.ExpandStringValueList(v.([]interface{})) } @@ -443,7 +443,7 @@ func flattenIPSet(apiObject *awstypes.IpSet) map[string]interface{} { tfMap := map[string]interface{}{} if v := apiObject.IpAddresses; v != nil { - tfMap["ip_addresses"] = v + tfMap[names.AttrIPAddresses] = v } if v := apiObject.IpFamily; v != nil { diff --git a/internal/service/globalaccelerator/accelerator_data_source.go b/internal/service/globalaccelerator/accelerator_data_source.go index 19d193f4a9f..58cb9367fb2 100644 --- a/internal/service/globalaccelerator/accelerator_data_source.go +++ b/internal/service/globalaccelerator/accelerator_data_source.go @@ -76,8 +76,8 @@ func (d *acceleratorDataSource) Schema(ctx context.Context, request datasource.S Computed: true, ElementType: types.ObjectType{ AttrTypes: map[string]attr.Type{ - "ip_addresses": types.ListType{ElemType: types.StringType}, - "ip_family": types.StringType, + names.AttrIPAddresses: types.ListType{ElemType: types.StringType}, + "ip_family": types.StringType, }, }, }, @@ -171,8 +171,8 @@ func (d *acceleratorDataSource) Read(ctx context.Context, request datasource.Rea func (d *acceleratorDataSource) flattenIPSetFramework(ctx context.Context, apiObject *awstypes.IpSet) types.Object { attributeTypes := map[string]attr.Type{ - "ip_addresses": types.ListType{ElemType: types.StringType}, - "ip_family": types.StringType, + names.AttrIPAddresses: types.ListType{ElemType: types.StringType}, + "ip_family": types.StringType, } if apiObject == nil { @@ -180,8 +180,8 @@ func (d *acceleratorDataSource) flattenIPSetFramework(ctx context.Context, apiOb } attributes := map[string]attr.Value{ - "ip_addresses": flex.FlattenFrameworkStringValueListLegacy(ctx, apiObject.IpAddresses), - "ip_family": flex.StringToFrameworkLegacy(ctx, apiObject.IpFamily), + names.AttrIPAddresses: flex.FlattenFrameworkStringValueListLegacy(ctx, apiObject.IpAddresses), + "ip_family": flex.StringToFrameworkLegacy(ctx, apiObject.IpFamily), } return types.ObjectValueMust(attributeTypes, attributes) @@ -189,8 +189,8 @@ func (d *acceleratorDataSource) flattenIPSetFramework(ctx context.Context, apiOb func (d *acceleratorDataSource) flattenIPSetsFramework(ctx context.Context, apiObjects []awstypes.IpSet) types.List { elementType := types.ObjectType{AttrTypes: map[string]attr.Type{ - "ip_addresses": types.ListType{ElemType: types.StringType}, - "ip_family": types.StringType, + names.AttrIPAddresses: types.ListType{ElemType: types.StringType}, + "ip_family": types.StringType, }} var elements []attr.Value diff --git a/internal/service/globalaccelerator/custom_routing_accelerator.go b/internal/service/globalaccelerator/custom_routing_accelerator.go index f9401d7cdab..ff3837de545 100644 --- a/internal/service/globalaccelerator/custom_routing_accelerator.go +++ b/internal/service/globalaccelerator/custom_routing_accelerator.go @@ -91,7 +91,7 @@ func resourceCustomRoutingAccelerator() *schema.Resource { Default: awstypes.IpAddressTypeIpv4, ValidateDiagFunc: enum.Validate[awstypes.IpAddressType](), }, - "ip_addresses": { + names.AttrIPAddresses: { Type: schema.TypeList, Optional: true, ForceNew: true, @@ -102,7 +102,7 @@ func resourceCustomRoutingAccelerator() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "ip_addresses": { + names.AttrIPAddresses: { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -148,7 +148,7 @@ func resourceCustomRoutingAcceleratorCreate(ctx context.Context, d *schema.Resou input.IpAddressType = awstypes.IpAddressType(v.(string)) } - if v, ok := d.GetOk("ip_addresses"); ok && len(v.([]interface{})) > 0 { + if v, ok := d.GetOk(names.AttrIPAddresses); ok && len(v.([]interface{})) > 0 { input.IpAddresses = flex.ExpandStringValueList(v.([]interface{})) } diff --git a/internal/service/globalaccelerator/custom_routing_accelerator_data_source.go b/internal/service/globalaccelerator/custom_routing_accelerator_data_source.go index c0a47d17cf7..7c03093d4ab 100644 --- a/internal/service/globalaccelerator/custom_routing_accelerator_data_source.go +++ b/internal/service/globalaccelerator/custom_routing_accelerator_data_source.go @@ -69,7 +69,7 @@ func dataSourceCustomRoutingAccelerator() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "ip_addresses": { + names.AttrIPAddresses: { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, diff --git a/internal/service/imagebuilder/container_recipe.go b/internal/service/imagebuilder/container_recipe.go index 3d7fc461ab6..68b4c065246 100644 --- a/internal/service/imagebuilder/container_recipe.go +++ b/internal/service/imagebuilder/container_recipe.go @@ -166,7 +166,7 @@ func ResourceContainerRecipe() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 1024), }, - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Optional: true, ForceNew: true, diff --git a/internal/service/imagebuilder/container_recipe_data_source.go b/internal/service/imagebuilder/container_recipe_data_source.go index c6f4b8043b8..eccbc118f1f 100644 --- a/internal/service/imagebuilder/container_recipe_data_source.go +++ b/internal/service/imagebuilder/container_recipe_data_source.go @@ -114,7 +114,7 @@ func DataSourceContainerRecipe() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Computed: true, }, diff --git a/internal/service/imagebuilder/image_recipe.go b/internal/service/imagebuilder/image_recipe.go index afa83c15a14..fd0df026b85 100644 --- a/internal/service/imagebuilder/image_recipe.go +++ b/internal/service/imagebuilder/image_recipe.go @@ -91,7 +91,7 @@ func ResourceImageRecipe() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 1024), }, - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Optional: true, ForceNew: true, @@ -499,7 +499,7 @@ func expandEBSInstanceBlockDeviceSpecification(tfMap map[string]interface{}) *im apiObject.SnapshotId = aws.String(v) } - if v, ok := tfMap["throughput"].(int); ok && v != 0 { + if v, ok := tfMap[names.AttrThroughput].(int); ok && v != 0 { apiObject.Throughput = aws.Int64(int64(v)) } @@ -682,7 +682,7 @@ func flattenEBSInstanceBlockDeviceSpecification(apiObject *imagebuilder.EbsInsta } if v := apiObject.Throughput; v != nil { - tfMap["throughput"] = aws.Int64Value(v) + tfMap[names.AttrThroughput] = aws.Int64Value(v) } if v := apiObject.VolumeSize; v != nil { diff --git a/internal/service/imagebuilder/image_recipe_data_source.go b/internal/service/imagebuilder/image_recipe_data_source.go index bfa025193ea..ef8c5fb1a67 100644 --- a/internal/service/imagebuilder/image_recipe_data_source.go +++ b/internal/service/imagebuilder/image_recipe_data_source.go @@ -62,7 +62,7 @@ func DataSourceImageRecipe() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Computed: true, }, diff --git a/internal/service/kms/key_data_source.go b/internal/service/kms/key_data_source.go index ab133b2f5a4..0bcf2cf485d 100644 --- a/internal/service/kms/key_data_source.go +++ b/internal/service/kms/key_data_source.go @@ -27,7 +27,7 @@ func dataSourceKey() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "aws_account_id": { + names.AttrAWSAccountID: { Type: schema.TypeString, Computed: true, }, @@ -186,7 +186,7 @@ func dataSourceKeyRead(ctx context.Context, d *schema.ResourceData, meta interfa d.SetId(aws.ToString(output.KeyId)) d.Set(names.AttrARN, output.Arn) - d.Set("aws_account_id", output.AWSAccountId) + d.Set(names.AttrAWSAccountID, output.AWSAccountId) d.Set("cloud_hsm_cluster_id", output.CloudHsmClusterId) d.Set(names.AttrCreationDate, aws.ToTime(output.CreationDate).Format(time.RFC3339)) d.Set("customer_master_key_spec", output.CustomerMasterKeySpec) diff --git a/internal/service/kms/key_data_source_test.go b/internal/service/kms/key_data_source_test.go index 34a6bd54df2..bf8fa7ccc28 100644 --- a/internal/service/kms/key_data_source_test.go +++ b/internal/service/kms/key_data_source_test.go @@ -28,7 +28,7 @@ func TestAccKMSKeyDataSource_byKeyARN(t *testing.T) { Config: testAccKeyDataSourceConfig_byKeyARN(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), - acctest.CheckResourceAttrAccountID(dataSourceName, "aws_account_id"), + acctest.CheckResourceAttrAccountID(dataSourceName, names.AttrAWSAccountID), resource.TestCheckResourceAttrSet(dataSourceName, names.AttrCreationDate), resource.TestCheckResourceAttrPair(dataSourceName, "customer_master_key_spec", resourceName, "customer_master_key_spec"), resource.TestCheckNoResourceAttr(dataSourceName, "deletion_date"), @@ -63,7 +63,7 @@ func TestAccKMSKeyDataSource_byKeyID(t *testing.T) { Config: testAccKeyDataSourceConfig_byKeyID(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), - acctest.CheckResourceAttrAccountID(dataSourceName, "aws_account_id"), + acctest.CheckResourceAttrAccountID(dataSourceName, names.AttrAWSAccountID), resource.TestCheckResourceAttrSet(dataSourceName, names.AttrCreationDate), resource.TestCheckResourceAttrPair(dataSourceName, "customer_master_key_spec", resourceName, "customer_master_key_spec"), resource.TestCheckNoResourceAttr(dataSourceName, "deletion_date"), @@ -98,7 +98,7 @@ func TestAccKMSKeyDataSource_byAliasARN(t *testing.T) { Config: testAccKeyDataSourceConfig_byAliasARN(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), - acctest.CheckResourceAttrAccountID(dataSourceName, "aws_account_id"), + acctest.CheckResourceAttrAccountID(dataSourceName, names.AttrAWSAccountID), resource.TestCheckResourceAttrSet(dataSourceName, names.AttrCreationDate), resource.TestCheckResourceAttrPair(dataSourceName, "customer_master_key_spec", resourceName, "customer_master_key_spec"), resource.TestCheckNoResourceAttr(dataSourceName, "deletion_date"), @@ -133,7 +133,7 @@ func TestAccKMSKeyDataSource_byAliasID(t *testing.T) { Config: testAccKeyDataSourceConfig_byAliasID(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), - acctest.CheckResourceAttrAccountID(dataSourceName, "aws_account_id"), + acctest.CheckResourceAttrAccountID(dataSourceName, names.AttrAWSAccountID), resource.TestCheckResourceAttr(dataSourceName, "cloud_hsm_cluster_id", ""), resource.TestCheckResourceAttrSet(dataSourceName, names.AttrCreationDate), resource.TestCheckResourceAttrPair(dataSourceName, "customer_master_key_spec", resourceName, "customer_master_key_spec"), @@ -173,7 +173,7 @@ func TestAccKMSKeyDataSource_grantToken(t *testing.T) { Config: testAccKeyDataSourceConfig_grantToken(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), - acctest.CheckResourceAttrAccountID(dataSourceName, "aws_account_id"), + acctest.CheckResourceAttrAccountID(dataSourceName, names.AttrAWSAccountID), resource.TestCheckResourceAttrSet(dataSourceName, names.AttrCreationDate), resource.TestCheckResourceAttrPair(dataSourceName, "customer_master_key_spec", resourceName, "customer_master_key_spec"), resource.TestCheckNoResourceAttr(dataSourceName, "deletion_date"), @@ -208,7 +208,7 @@ func TestAccKMSKeyDataSource_multiRegionConfigurationByARN(t *testing.T) { Config: testAccKeyDataSourceConfig_multiRegionByARN(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), - acctest.CheckResourceAttrAccountID(dataSourceName, "aws_account_id"), + acctest.CheckResourceAttrAccountID(dataSourceName, names.AttrAWSAccountID), resource.TestCheckResourceAttrSet(dataSourceName, names.AttrCreationDate), resource.TestCheckResourceAttrPair(dataSourceName, "customer_master_key_spec", resourceName, "customer_master_key_spec"), resource.TestCheckNoResourceAttr(dataSourceName, "deletion_date"), @@ -248,7 +248,7 @@ func TestAccKMSKeyDataSource_multiRegionConfigurationByID(t *testing.T) { Config: testAccKeyDataSourceConfig_multiRegionByID(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), - acctest.CheckResourceAttrAccountID(dataSourceName, "aws_account_id"), + acctest.CheckResourceAttrAccountID(dataSourceName, names.AttrAWSAccountID), resource.TestCheckResourceAttrSet(dataSourceName, names.AttrCreationDate), resource.TestCheckResourceAttrPair(dataSourceName, "customer_master_key_spec", resourceName, "customer_master_key_spec"), resource.TestCheckNoResourceAttr(dataSourceName, "deletion_date"), diff --git a/internal/service/lexv2models/bot_locale.go b/internal/service/lexv2models/bot_locale.go index 4788fff08f6..a0bcef7617f 100644 --- a/internal/service/lexv2models/bot_locale.go +++ b/internal/service/lexv2models/bot_locale.go @@ -107,7 +107,7 @@ func (r *resourceBotLocale) Schema(ctx context.Context, req resource.SchemaReque "voice_id": schema.StringAttribute{ Required: true, }, - "engine": schema.StringAttribute{ + names.AttrEngine: schema.StringAttribute{ Optional: true, Computed: true, Validators: []validator.String{ @@ -476,8 +476,8 @@ func flattenVoiceSettings(ctx context.Context, apiObject *awstypes.VoiceSettings } obj := map[string]attr.Value{ - "voice_id": flex.StringValueToFramework(ctx, *apiObject.VoiceId), - "engine": flex.StringValueToFramework(ctx, apiObject.Engine), + "voice_id": flex.StringValueToFramework(ctx, *apiObject.VoiceId), + names.AttrEngine: flex.StringValueToFramework(ctx, apiObject.Engine), } objVal, d := types.ObjectValue(voiceSettingsAttrTypes, obj) diags.Append(d...) @@ -518,8 +518,8 @@ type voiceSettingsData struct { } var voiceSettingsAttrTypes = map[string]attr.Type{ - "voice_id": types.StringType, - "engine": types.StringType, + "voice_id": types.StringType, + names.AttrEngine: types.StringType, } // refreshFromOutput writes state data from an AWS response object diff --git a/internal/service/lexv2models/bot_locale_test.go b/internal/service/lexv2models/bot_locale_test.go index bcd5e47cf73..e96b3984111 100644 --- a/internal/service/lexv2models/bot_locale_test.go +++ b/internal/service/lexv2models/bot_locale_test.go @@ -112,8 +112,8 @@ func TestAccLexV2ModelsBotLocale_voiceSettings(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckBotLocaleExists(ctx, resourceName, &botlocale), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "voice_settings.*", map[string]string{ - "voice_id": voiceID, - "engine": string(types.VoiceEngineStandard), + "voice_id": voiceID, + names.AttrEngine: string(types.VoiceEngineStandard), }), ), }, diff --git a/internal/service/licensemanager/license_configuration.go b/internal/service/licensemanager/license_configuration.go index 9e2205ebf4e..0df7bc199a5 100644 --- a/internal/service/licensemanager/license_configuration.go +++ b/internal/service/licensemanager/license_configuration.go @@ -74,7 +74,7 @@ func ResourceLicenseConfiguration() *schema.Resource { Type: schema.TypeString, Required: true, }, - "owner_account_id": { + names.AttrOwnerAccountID: { Type: schema.TypeString, Computed: true, }, @@ -149,7 +149,7 @@ func resourceLicenseConfigurationRead(ctx context.Context, d *schema.ResourceDat d.Set("license_counting_type", output.LicenseCountingType) d.Set("license_rules", aws.StringValueSlice(output.LicenseRules)) d.Set(names.AttrName, output.Name) - d.Set("owner_account_id", output.OwnerAccountId) + d.Set(names.AttrOwnerAccountID, output.OwnerAccountId) setTagsOut(ctx, output.Tags) diff --git a/internal/service/licensemanager/license_configuration_test.go b/internal/service/licensemanager/license_configuration_test.go index 19ab47e40d9..bc7b706bc79 100644 --- a/internal/service/licensemanager/license_configuration_test.go +++ b/internal/service/licensemanager/license_configuration_test.go @@ -53,7 +53,7 @@ func TestAccLicenseManagerLicenseConfiguration_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "license_counting_type", "Instance"), resource.TestCheckResourceAttr(resourceName, "license_rules.#", acctest.Ct0), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - acctest.CheckResourceAttrAccountID(resourceName, "owner_account_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrOwnerAccountID), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct0), ), }, @@ -161,7 +161,7 @@ func TestAccLicenseManagerLicenseConfiguration_update(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "license_rules.#", acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "license_rules.0", "#minimumSockets=3"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName1), - acctest.CheckResourceAttrAccountID(resourceName, "owner_account_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrOwnerAccountID), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct0), ), }, @@ -182,7 +182,7 @@ func TestAccLicenseManagerLicenseConfiguration_update(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "license_rules.#", acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "license_rules.0", "#minimumSockets=3"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName2), - acctest.CheckResourceAttrAccountID(resourceName, "owner_account_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrOwnerAccountID), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct0), ), }, diff --git a/internal/service/lightsail/database.go b/internal/service/lightsail/database.go index deb530f93c7..9bf8848d4f9 100644 --- a/internal/service/lightsail/database.go +++ b/internal/service/lightsail/database.go @@ -86,7 +86,7 @@ func ResourceDatabase() *schema.Resource { Type: schema.TypeFloat, Computed: true, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Computed: true, }, @@ -302,7 +302,7 @@ func resourceDatabaseRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set("cpu_count", rd.Hardware.CpuCount) d.Set(names.AttrCreatedAt, rd.CreatedAt.Format(time.RFC3339)) d.Set("disk_size", rd.Hardware.DiskSizeInGb) - d.Set("engine", rd.Engine) + d.Set(names.AttrEngine, rd.Engine) d.Set(names.AttrEngineVersion, rd.EngineVersion) d.Set("master_database_name", rd.MasterDatabaseName) d.Set("master_endpoint_address", rd.MasterEndpoint.Address) diff --git a/internal/service/lightsail/database_test.go b/internal/service/lightsail/database_test.go index c0009cfa789..5d8075d205a 100644 --- a/internal/service/lightsail/database_test.go +++ b/internal/service/lightsail/database_test.go @@ -52,7 +52,7 @@ func TestAccLightsailDatabase_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, names.AttrAvailabilityZone), resource.TestCheckResourceAttrSet(resourceName, names.AttrARN), resource.TestCheckResourceAttrSet(resourceName, names.AttrCreatedAt), - resource.TestCheckResourceAttrSet(resourceName, "engine"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEngine), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), resource.TestCheckResourceAttrSet(resourceName, "cpu_count"), resource.TestCheckResourceAttrSet(resourceName, "ram_size"), diff --git a/internal/service/m2/application.go b/internal/service/m2/application.go index 10ed533b452..6012c186a80 100644 --- a/internal/service/m2/application.go +++ b/internal/service/m2/application.go @@ -61,8 +61,8 @@ func (*applicationResource) Metadata(_ context.Context, request resource.Metadat func (r *applicationResource) Schema(ctx context.Context, request resource.SchemaRequest, response *resource.SchemaResponse) { response.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ - "application_id": framework.IDAttribute(), - names.AttrARN: framework.ARNAttributeComputedOnly(), + names.AttrApplicationID: framework.IDAttribute(), + names.AttrARN: framework.ARNAttributeComputedOnly(), "current_version": schema.Int64Attribute{ Computed: true, }, diff --git a/internal/service/m2/application_test.go b/internal/service/m2/application_test.go index c2f06469111..be3ceefc1b0 100644 --- a/internal/service/m2/application_test.go +++ b/internal/service/m2/application_test.go @@ -43,7 +43,7 @@ func TestAccM2Application_basic(t *testing.T) { Config: testAccApplicationConfig_basic(rName, "bluage"), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckApplicationExists(ctx, resourceName, &application), - resource.TestCheckResourceAttrSet(resourceName, "application_id"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrApplicationID), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "m2", regexache.MustCompile(`app/.+`)), resource.TestCheckResourceAttr(resourceName, "current_version", acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "definition.#", acctest.Ct1), @@ -169,7 +169,7 @@ func TestAccM2Application_full(t *testing.T) { Config: testAccApplicationConfig_full(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckApplicationExists(ctx, resourceName, &application), - resource.TestCheckResourceAttrSet(resourceName, "application_id"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrApplicationID), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "m2", regexache.MustCompile(`app/.+`)), resource.TestCheckResourceAttr(resourceName, "current_version", acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "definition.#", acctest.Ct1), diff --git a/internal/service/m2/deployment.go b/internal/service/m2/deployment.go index 44a41ea896c..a6abf897ebf 100644 --- a/internal/service/m2/deployment.go +++ b/internal/service/m2/deployment.go @@ -54,7 +54,7 @@ func (*deploymentResource) Metadata(_ context.Context, request resource.Metadata func (r *deploymentResource) Schema(ctx context.Context, request resource.SchemaRequest, response *resource.SchemaResponse) { response.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ - "application_id": schema.StringAttribute{ + names.AttrApplicationID: schema.StringAttribute{ Required: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.RequiresReplace(), diff --git a/internal/service/m2/deployment_test.go b/internal/service/m2/deployment_test.go index 9e3f4bb7460..59f8213c6ee 100644 --- a/internal/service/m2/deployment_test.go +++ b/internal/service/m2/deployment_test.go @@ -178,7 +178,7 @@ func testAccCheckDeploymentDestroy(ctx context.Context) resource.TestCheckFunc { continue } - _, err := tfm2.FindDeploymentByTwoPartKey(ctx, conn, rs.Primary.Attributes["application_id"], rs.Primary.Attributes["deployment_id"]) + _, err := tfm2.FindDeploymentByTwoPartKey(ctx, conn, rs.Primary.Attributes[names.AttrApplicationID], rs.Primary.Attributes["deployment_id"]) if tfresource.NotFound(err) { continue @@ -204,7 +204,7 @@ func testAccCheckDeploymentExists(ctx context.Context, n string, v *m2.GetDeploy conn := acctest.Provider.Meta().(*conns.AWSClient).M2Client(ctx) - output, err := tfm2.FindDeploymentByTwoPartKey(ctx, conn, rs.Primary.Attributes["application_id"], rs.Primary.Attributes["deployment_id"]) + output, err := tfm2.FindDeploymentByTwoPartKey(ctx, conn, rs.Primary.Attributes[names.AttrApplicationID], rs.Primary.Attributes["deployment_id"]) if err != nil { return err diff --git a/internal/service/memorydb/cluster.go b/internal/service/memorydb/cluster.go index fe65b679fa5..6da7b982844 100644 --- a/internal/service/memorydb/cluster.go +++ b/internal/service/memorydb/cluster.go @@ -137,7 +137,7 @@ func ResourceCluster() *schema.Resource { Default: 1, ValidateFunc: validation.IntAtLeast(1), }, - "parameter_group_name": { + names.AttrParameterGroupName: { Type: schema.TypeString, Optional: true, Computed: true, @@ -308,7 +308,7 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, meta int input.MaintenanceWindow = aws.String(v.(string)) } - if v, ok := d.GetOk("parameter_group_name"); ok { + if v, ok := d.GetOk(names.AttrParameterGroupName); ok { input.ParameterGroupName = aws.String(v.(string)) } @@ -408,8 +408,8 @@ func resourceClusterUpdate(ctx context.Context, d *schema.ResourceData, meta int } } - if d.HasChange("parameter_group_name") { - input.ParameterGroupName = aws.String(d.Get("parameter_group_name").(string)) + if d.HasChange(names.AttrParameterGroupName) { + input.ParameterGroupName = aws.String(d.Get(names.AttrParameterGroupName).(string)) waitParameterGroupInSync = true } @@ -526,7 +526,7 @@ func resourceClusterRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set("num_replicas_per_shard", numReplicasPerShard) d.Set("num_shards", cluster.NumberOfShards) - d.Set("parameter_group_name", cluster.ParameterGroupName) + d.Set(names.AttrParameterGroupName, cluster.ParameterGroupName) var securityGroupIds []*string for _, v := range cluster.SecurityGroups { diff --git a/internal/service/memorydb/cluster_data_source.go b/internal/service/memorydb/cluster_data_source.go index 48897c02cb9..75365af1404 100644 --- a/internal/service/memorydb/cluster_data_source.go +++ b/internal/service/memorydb/cluster_data_source.go @@ -81,7 +81,7 @@ func DataSourceCluster() *schema.Resource { Type: schema.TypeInt, Computed: true, }, - "parameter_group_name": { + names.AttrParameterGroupName: { Type: schema.TypeString, Computed: true, }, @@ -213,7 +213,7 @@ func dataSourceClusterRead(ctx context.Context, d *schema.ResourceData, meta int d.Set("num_replicas_per_shard", numReplicasPerShard) d.Set("num_shards", cluster.NumberOfShards) - d.Set("parameter_group_name", cluster.ParameterGroupName) + d.Set(names.AttrParameterGroupName, cluster.ParameterGroupName) var securityGroupIds []*string for _, v := range cluster.SecurityGroups { diff --git a/internal/service/memorydb/cluster_data_source_test.go b/internal/service/memorydb/cluster_data_source_test.go index e0246fade16..f58c26f66a2 100644 --- a/internal/service/memorydb/cluster_data_source_test.go +++ b/internal/service/memorydb/cluster_data_source_test.go @@ -42,7 +42,7 @@ func TestAccMemoryDBClusterDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "node_type", resourceName, "node_type"), resource.TestCheckResourceAttrPair(dataSourceName, "num_replicas_per_shard", resourceName, "num_replicas_per_shard"), resource.TestCheckResourceAttrPair(dataSourceName, "num_shards", resourceName, "num_shards"), - resource.TestCheckResourceAttrPair(dataSourceName, "parameter_group_name", resourceName, "parameter_group_name"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrParameterGroupName, resourceName, names.AttrParameterGroupName), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrPort, resourceName, names.AttrPort), resource.TestCheckResourceAttr(dataSourceName, "security_group_ids.#", acctest.Ct1), resource.TestCheckTypeSetElemAttrPair(dataSourceName, "security_group_ids.*", resourceName, "security_group_ids.0"), diff --git a/internal/service/memorydb/cluster_test.go b/internal/service/memorydb/cluster_test.go index ab1609457dd..72cd0c3c694 100644 --- a/internal/service/memorydb/cluster_test.go +++ b/internal/service/memorydb/cluster_test.go @@ -49,7 +49,7 @@ func TestAccMemoryDBCluster_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "node_type", "db.t4g.small"), resource.TestCheckResourceAttr(resourceName, "num_replicas_per_shard", acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "num_shards", acctest.Ct2), - resource.TestCheckResourceAttrSet(resourceName, "parameter_group_name"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrParameterGroupName), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "6379"), resource.TestCheckResourceAttr(resourceName, "security_group_ids.#", acctest.Ct1), resource.TestCheckTypeSetElemAttrPair(resourceName, "security_group_ids.*", "aws_security_group.test", names.AttrID), @@ -111,7 +111,7 @@ func TestAccMemoryDBCluster_defaults(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "node_type", "db.t4g.small"), resource.TestCheckResourceAttr(resourceName, "num_replicas_per_shard", acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "num_shards", acctest.Ct1), - resource.TestCheckResourceAttrSet(resourceName, "parameter_group_name"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrParameterGroupName), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "6379"), resource.TestCheckResourceAttr(resourceName, "security_group_ids.#", acctest.Ct0), resource.TestCheckResourceAttr(resourceName, "snapshot_retention_limit", acctest.Ct0), @@ -756,7 +756,7 @@ func TestAccMemoryDBCluster_Update_parameterGroup(t *testing.T) { Config: testAccClusterConfig_parameterGroup(rName, "default.memorydb-redis7"), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "parameter_group_name", "default.memorydb-redis7"), + resource.TestCheckResourceAttr(resourceName, names.AttrParameterGroupName, "default.memorydb-redis7"), ), }, { @@ -768,14 +768,14 @@ func TestAccMemoryDBCluster_Update_parameterGroup(t *testing.T) { Config: testAccClusterConfig_parameterGroup(rName, rName), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "parameter_group_name", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrParameterGroupName, rName), ), }, { Config: testAccClusterConfig_parameterGroup(rName, "default.memorydb-redis7"), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "parameter_group_name", "default.memorydb-redis7"), + resource.TestCheckResourceAttr(resourceName, names.AttrParameterGroupName, "default.memorydb-redis7"), ), }, { diff --git a/internal/service/memorydb/snapshot.go b/internal/service/memorydb/snapshot.go index 6006a96d00b..dcf582f82ec 100644 --- a/internal/service/memorydb/snapshot.go +++ b/internal/service/memorydb/snapshot.go @@ -76,7 +76,7 @@ func ResourceSnapshot() *schema.Resource { Type: schema.TypeInt, Computed: true, }, - "parameter_group_name": { + names.AttrParameterGroupName: { Type: schema.TypeString, Computed: true, }, @@ -246,19 +246,19 @@ func flattenClusterConfiguration(v *memorydb.ClusterConfiguration) []interface{} } m := map[string]interface{}{ - names.AttrDescription: aws.StringValue(v.Description), - names.AttrEngineVersion: aws.StringValue(v.EngineVersion), - "maintenance_window": aws.StringValue(v.MaintenanceWindow), - names.AttrName: aws.StringValue(v.Name), - "node_type": aws.StringValue(v.NodeType), - "num_shards": aws.Int64Value(v.NumShards), - "parameter_group_name": aws.StringValue(v.ParameterGroupName), - names.AttrPort: aws.Int64Value(v.Port), - "snapshot_retention_limit": aws.Int64Value(v.SnapshotRetentionLimit), - "snapshot_window": aws.StringValue(v.SnapshotWindow), - "subnet_group_name": aws.StringValue(v.SubnetGroupName), - names.AttrTopicARN: aws.StringValue(v.TopicArn), - names.AttrVPCID: aws.StringValue(v.VpcId), + names.AttrDescription: aws.StringValue(v.Description), + names.AttrEngineVersion: aws.StringValue(v.EngineVersion), + "maintenance_window": aws.StringValue(v.MaintenanceWindow), + names.AttrName: aws.StringValue(v.Name), + "node_type": aws.StringValue(v.NodeType), + "num_shards": aws.Int64Value(v.NumShards), + names.AttrParameterGroupName: aws.StringValue(v.ParameterGroupName), + names.AttrPort: aws.Int64Value(v.Port), + "snapshot_retention_limit": aws.Int64Value(v.SnapshotRetentionLimit), + "snapshot_window": aws.StringValue(v.SnapshotWindow), + "subnet_group_name": aws.StringValue(v.SubnetGroupName), + names.AttrTopicARN: aws.StringValue(v.TopicArn), + names.AttrVPCID: aws.StringValue(v.VpcId), } return []interface{}{m} diff --git a/internal/service/memorydb/snapshot_data_source.go b/internal/service/memorydb/snapshot_data_source.go index 1b6cccbaf7c..734a27c9ebd 100644 --- a/internal/service/memorydb/snapshot_data_source.go +++ b/internal/service/memorydb/snapshot_data_source.go @@ -55,7 +55,7 @@ func DataSourceSnapshot() *schema.Resource { Type: schema.TypeInt, Computed: true, }, - "parameter_group_name": { + names.AttrParameterGroupName: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/memorydb/snapshot_test.go b/internal/service/memorydb/snapshot_test.go index 9a97db877be..35eb592f457 100644 --- a/internal/service/memorydb/snapshot_test.go +++ b/internal/service/memorydb/snapshot_test.go @@ -40,7 +40,7 @@ func TestAccMemoryDBSnapshot_basic(t *testing.T) { resource.TestCheckTypeSetElemAttrPair(resourceName, "cluster_configuration.0.name", "aws_memorydb_cluster.test", names.AttrName), resource.TestCheckTypeSetElemAttrPair(resourceName, "cluster_configuration.0.node_type", "aws_memorydb_cluster.test", "node_type"), resource.TestCheckTypeSetElemAttrPair(resourceName, "cluster_configuration.0.num_shards", "aws_memorydb_cluster.test", "num_shards"), - resource.TestCheckTypeSetElemAttrPair(resourceName, "cluster_configuration.0.parameter_group_name", "aws_memorydb_cluster.test", "parameter_group_name"), + resource.TestCheckTypeSetElemAttrPair(resourceName, "cluster_configuration.0.parameter_group_name", "aws_memorydb_cluster.test", names.AttrParameterGroupName), resource.TestCheckTypeSetElemAttrPair(resourceName, "cluster_configuration.0.port", "aws_memorydb_cluster.test", names.AttrPort), resource.TestCheckTypeSetElemAttrPair(resourceName, "cluster_configuration.0.snapshot_retention_limit", "aws_memorydb_cluster.test", "snapshot_retention_limit"), resource.TestCheckTypeSetElemAttrPair(resourceName, "cluster_configuration.0.snapshot_window", "aws_memorydb_cluster.test", "snapshot_window"), diff --git a/internal/service/neptune/cluster.go b/internal/service/neptune/cluster.go index 42762e77daf..8120070e7c6 100644 --- a/internal/service/neptune/cluster.go +++ b/internal/service/neptune/cluster.go @@ -138,7 +138,7 @@ func ResourceCluster() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -282,7 +282,7 @@ func ResourceCluster() *schema.Resource { return new == "" }, }, - "storage_encrypted": { + names.AttrStorageEncrypted: { Type: schema.TypeBool, Optional: true, ForceNew: true, @@ -339,17 +339,17 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, meta int CopyTagsToSnapshot: aws.Bool(d.Get("copy_tags_to_snapshot").(bool)), DBClusterIdentifier: aws.String(clusterID), DeletionProtection: aws.Bool(d.Get("deletion_protection").(bool)), - Engine: aws.String(d.Get("engine").(string)), + Engine: aws.String(d.Get(names.AttrEngine).(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), ServerlessV2ScalingConfiguration: serverlessConfiguration, - StorageEncrypted: aws.Bool(d.Get("storage_encrypted").(bool)), + StorageEncrypted: aws.Bool(d.Get(names.AttrStorageEncrypted).(bool)), Tags: getTagsIn(ctx), } inputR := &neptune.RestoreDBClusterFromSnapshotInput{ CopyTagsToSnapshot: aws.Bool(d.Get("copy_tags_to_snapshot").(bool)), DBClusterIdentifier: aws.String(clusterID), DeletionProtection: aws.Bool(d.Get("deletion_protection").(bool)), - Engine: aws.String(d.Get("engine").(string)), + Engine: aws.String(d.Get(names.AttrEngine).(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), ServerlessV2ScalingConfiguration: serverlessConfiguration, SnapshotIdentifier: aws.String(d.Get("snapshot_identifier").(string)), @@ -550,7 +550,7 @@ func resourceClusterRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set("enable_cloudwatch_logs_exports", aws.StringValueSlice(dbc.EnabledCloudwatchLogsExports)) d.Set(names.AttrEndpoint, dbc.Endpoint) d.Set(names.AttrEngineVersion, dbc.EngineVersion) - d.Set("engine", dbc.Engine) + d.Set(names.AttrEngine, dbc.Engine) d.Set(names.AttrHostedZoneID, dbc.HostedZoneId) d.Set("iam_database_authentication_enabled", dbc.IAMDatabaseAuthenticationEnabled) var iamRoles []string @@ -569,7 +569,7 @@ func resourceClusterRead(ctx context.Context, d *schema.ResourceData, meta inter if err := d.Set("serverless_v2_scaling_configuration", flattenServerlessV2ScalingConfigurationInfo(dbc.ServerlessV2ScalingConfiguration)); err != nil { return sdkdiag.AppendErrorf(diags, "setting serverless_v2_scaling_configuration: %s", err) } - d.Set("storage_encrypted", dbc.StorageEncrypted) + d.Set(names.AttrStorageEncrypted, dbc.StorageEncrypted) d.Set(names.AttrStorageType, dbc.StorageType) var securityGroupIDs []string for _, v := range dbc.VpcSecurityGroups { diff --git a/internal/service/neptune/cluster_instance.go b/internal/service/neptune/cluster_instance.go index b15bd8c1362..09e1215ea02 100644 --- a/internal/service/neptune/cluster_instance.go +++ b/internal/service/neptune/cluster_instance.go @@ -84,7 +84,7 @@ func ResourceClusterInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -170,7 +170,7 @@ func ResourceClusterInstance() *schema.Resource { Type: schema.TypeBool, Optional: true, }, - "storage_encrypted": { + names.AttrStorageEncrypted: { Type: schema.TypeBool, Computed: true, }, @@ -204,7 +204,7 @@ func resourceClusterInstanceCreate(ctx context.Context, d *schema.ResourceData, DBClusterIdentifier: aws.String(d.Get(names.AttrClusterIdentifier).(string)), DBInstanceClass: aws.String(d.Get("instance_class").(string)), DBInstanceIdentifier: aws.String(instanceID), - Engine: aws.String(d.Get("engine").(string)), + Engine: aws.String(d.Get(names.AttrEngine).(string)), PromotionTier: aws.Int64(int64(d.Get("promotion_tier").(int))), PubliclyAccessible: aws.Bool(d.Get(names.AttrPubliclyAccessible).(bool)), Tags: getTagsIn(ctx), @@ -274,7 +274,7 @@ func resourceClusterInstanceRead(ctx context.Context, d *schema.ResourceData, me d.Set(names.AttrClusterIdentifier, clusterID) d.Set("dbi_resource_id", db.DbiResourceId) d.Set(names.AttrEngineVersion, db.EngineVersion) - d.Set("engine", db.Engine) + d.Set(names.AttrEngine, db.Engine) d.Set(names.AttrIdentifier, db.DBInstanceIdentifier) d.Set("identifier_prefix", create.NamePrefixFromName(aws.StringValue(db.DBInstanceIdentifier))) d.Set("instance_class", db.DBInstanceClass) @@ -289,7 +289,7 @@ func resourceClusterInstanceRead(ctx context.Context, d *schema.ResourceData, me d.Set(names.AttrPreferredMaintenanceWindow, db.PreferredMaintenanceWindow) d.Set("promotion_tier", db.PromotionTier) d.Set(names.AttrPubliclyAccessible, db.PubliclyAccessible) - d.Set("storage_encrypted", db.StorageEncrypted) + d.Set(names.AttrStorageEncrypted, db.StorageEncrypted) d.Set(names.AttrStorageType, db.StorageType) if db.Endpoint != nil { diff --git a/internal/service/neptune/cluster_instance_test.go b/internal/service/neptune/cluster_instance_test.go index 672c1391317..fa92ab85862 100644 --- a/internal/service/neptune/cluster_instance_test.go +++ b/internal/service/neptune/cluster_instance_test.go @@ -46,7 +46,7 @@ func TestAccNeptuneClusterInstance_basic(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, names.AttrClusterIdentifier, clusterResourceName, names.AttrID), resource.TestCheckResourceAttrSet(resourceName, "dbi_resource_id"), resource.TestCheckResourceAttrSet(resourceName, names.AttrAddress), - resource.TestCheckResourceAttr(resourceName, "engine", "neptune"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "neptune"), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), resource.TestCheckResourceAttr(resourceName, names.AttrIdentifier, rName), resource.TestCheckResourceAttr(resourceName, "identifier_prefix", ""), @@ -59,7 +59,7 @@ func TestAccNeptuneClusterInstance_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, names.AttrPreferredMaintenanceWindow), resource.TestCheckResourceAttr(resourceName, "promotion_tier", acctest.Ct3), resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, acctest.CtFalse), - resource.TestCheckResourceAttr(resourceName, "storage_encrypted", acctest.CtFalse), + resource.TestCheckResourceAttr(resourceName, names.AttrStorageEncrypted, acctest.CtFalse), resource.TestCheckResourceAttr(resourceName, names.AttrStorageType, "standard"), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct0), resource.TestCheckResourceAttr(resourceName, "writer", acctest.CtTrue), diff --git a/internal/service/neptune/cluster_snapshot.go b/internal/service/neptune/cluster_snapshot.go index 158a4e65099..e73abfd7dba 100644 --- a/internal/service/neptune/cluster_snapshot.go +++ b/internal/service/neptune/cluster_snapshot.go @@ -59,7 +59,7 @@ func ResourceClusterSnapshot() *schema.Resource { Required: true, ForceNew: true, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Computed: true, }, @@ -91,7 +91,7 @@ func ResourceClusterSnapshot() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "storage_encrypted": { + names.AttrStorageEncrypted: { Type: schema.TypeBool, Computed: true, }, @@ -149,7 +149,7 @@ func resourceClusterSnapshotRead(ctx context.Context, d *schema.ResourceData, me d.Set("db_cluster_identifier", snapshot.DBClusterIdentifier) d.Set("db_cluster_snapshot_arn", snapshot.DBClusterSnapshotArn) d.Set("db_cluster_snapshot_identifier", snapshot.DBClusterSnapshotIdentifier) - d.Set("engine", snapshot.Engine) + d.Set(names.AttrEngine, snapshot.Engine) d.Set(names.AttrEngineVersion, snapshot.EngineVersion) d.Set(names.AttrKMSKeyID, snapshot.KmsKeyId) d.Set("license_model", snapshot.LicenseModel) @@ -157,7 +157,7 @@ func resourceClusterSnapshotRead(ctx context.Context, d *schema.ResourceData, me d.Set("snapshot_type", snapshot.SnapshotType) d.Set("source_db_cluster_snapshot_arn", snapshot.SourceDBClusterSnapshotArn) d.Set(names.AttrStatus, snapshot.Status) - d.Set("storage_encrypted", snapshot.StorageEncrypted) + d.Set(names.AttrStorageEncrypted, snapshot.StorageEncrypted) d.Set(names.AttrVPCID, snapshot.VpcId) return diags diff --git a/internal/service/neptune/cluster_snapshot_test.go b/internal/service/neptune/cluster_snapshot_test.go index ac6544c2b58..4d5a94037ba 100644 --- a/internal/service/neptune/cluster_snapshot_test.go +++ b/internal/service/neptune/cluster_snapshot_test.go @@ -39,7 +39,7 @@ func TestAccNeptuneClusterSnapshot_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "allocated_storage"), resource.TestCheckResourceAttrSet(resourceName, "availability_zones.#"), acctest.CheckResourceAttrRegionalARN(resourceName, "db_cluster_snapshot_arn", "rds", fmt.Sprintf("cluster-snapshot:%s", rName)), - resource.TestCheckResourceAttrSet(resourceName, "engine"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEngine), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyID, ""), resource.TestCheckResourceAttrSet(resourceName, "license_model"), @@ -47,7 +47,7 @@ func TestAccNeptuneClusterSnapshot_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "snapshot_type", "manual"), resource.TestCheckResourceAttr(resourceName, "source_db_cluster_snapshot_arn", ""), resource.TestCheckResourceAttr(resourceName, names.AttrStatus, "available"), - resource.TestCheckResourceAttr(resourceName, "storage_encrypted", acctest.CtFalse), + resource.TestCheckResourceAttr(resourceName, names.AttrStorageEncrypted, acctest.CtFalse), resource.TestMatchResourceAttr(resourceName, names.AttrVPCID, regexache.MustCompile(`^vpc-.+`)), ), }, diff --git a/internal/service/neptune/cluster_test.go b/internal/service/neptune/cluster_test.go index 8d564178cb0..0230b7d627e 100644 --- a/internal/service/neptune/cluster_test.go +++ b/internal/service/neptune/cluster_test.go @@ -67,7 +67,7 @@ func TestAccNeptuneCluster_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "deletion_protection", acctest.CtFalse), resource.TestCheckResourceAttr(resourceName, "enable_cloudwatch_logs_exports.#", acctest.Ct0), resource.TestCheckResourceAttrSet(resourceName, names.AttrEndpoint), - resource.TestCheckResourceAttr(resourceName, "engine", "neptune"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "neptune"), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), resource.TestCheckNoResourceAttr(resourceName, "final_snapshot_identifier"), resource.TestCheckResourceAttr(resourceName, "global_cluster_identifier", ""), @@ -86,7 +86,7 @@ func TestAccNeptuneCluster_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "serverless_v2_scaling_configuration.#", acctest.Ct0), resource.TestCheckResourceAttr(resourceName, "skip_final_snapshot", acctest.CtTrue), resource.TestCheckNoResourceAttr(resourceName, "snapshot_identifier"), - resource.TestCheckResourceAttr(resourceName, "storage_encrypted", acctest.CtFalse), + resource.TestCheckResourceAttr(resourceName, names.AttrStorageEncrypted, acctest.CtFalse), resource.TestCheckResourceAttr(resourceName, names.AttrStorageType, ""), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct0), resource.TestCheckResourceAttr(resourceName, "vpc_security_group_ids.#", acctest.Ct1), @@ -376,7 +376,7 @@ func TestAccNeptuneCluster_encrypted(t *testing.T) { Config: testAccClusterConfig_encrypted(rName), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "storage_encrypted", acctest.CtTrue), + resource.TestCheckResourceAttr(resourceName, names.AttrStorageEncrypted, acctest.CtTrue), ), }, testAccClusterImportStep(resourceName), diff --git a/internal/service/neptune/engine_version_data_source.go b/internal/service/neptune/engine_version_data_source.go index b884f654544..9149d65159e 100644 --- a/internal/service/neptune/engine_version_data_source.go +++ b/internal/service/neptune/engine_version_data_source.go @@ -23,7 +23,7 @@ func DataSourceEngineVersion() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceEngineVersionRead, Schema: map[string]*schema.Schema{ - "engine": { + names.AttrEngine: { Type: schema.TypeString, Optional: true, Default: engineNeptune, @@ -86,7 +86,7 @@ func dataSourceEngineVersionRead(ctx context.Context, d *schema.ResourceData, me input := &neptune.DescribeDBEngineVersionsInput{} - if v, ok := d.GetOk("engine"); ok { + if v, ok := d.GetOk(names.AttrEngine); ok { input.Engine = aws.String(v.(string)) } @@ -132,7 +132,7 @@ func dataSourceEngineVersionRead(ctx context.Context, d *schema.ResourceData, me } d.SetId(aws.StringValue(engineVersion.EngineVersion)) - d.Set("engine", engineVersion.Engine) + d.Set(names.AttrEngine, engineVersion.Engine) d.Set("engine_description", engineVersion.DBEngineDescription) d.Set("exportable_log_types", aws.StringValueSlice(engineVersion.ExportableLogTypes)) d.Set("parameter_group_family", engineVersion.DBParameterGroupFamily) diff --git a/internal/service/neptune/engine_version_data_source_test.go b/internal/service/neptune/engine_version_data_source_test.go index fcfe99daf68..a33f8fdbcdf 100644 --- a/internal/service/neptune/engine_version_data_source_test.go +++ b/internal/service/neptune/engine_version_data_source_test.go @@ -30,7 +30,7 @@ func TestAccNeptuneEngineVersionDataSource_basic(t *testing.T) { { Config: testAccEngineVersionDataSourceConfig_basic(version), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(dataSourceName, "engine", "neptune"), + resource.TestCheckResourceAttr(dataSourceName, names.AttrEngine, "neptune"), resource.TestCheckResourceAttr(dataSourceName, names.AttrVersion, version), resource.TestCheckResourceAttrSet(dataSourceName, "engine_description"), resource.TestMatchResourceAttr(dataSourceName, "exportable_log_types.#", regexache.MustCompile(`^[1-9][0-9]*`)), @@ -58,7 +58,7 @@ func TestAccNeptuneEngineVersionDataSource_preferred(t *testing.T) { { Config: testAccEngineVersionDataSourceConfig_preferred(), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(dataSourceName, "engine", "neptune"), + resource.TestCheckResourceAttr(dataSourceName, names.AttrEngine, "neptune"), resource.TestCheckResourceAttr(dataSourceName, names.AttrVersion, "1.2.0.2"), ), }, @@ -78,7 +78,7 @@ func TestAccNeptuneEngineVersionDataSource_defaultOnly(t *testing.T) { { Config: testAccEngineVersionDataSourceConfig_defaultOnly(), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(dataSourceName, "engine", "neptune"), + resource.TestCheckResourceAttr(dataSourceName, names.AttrEngine, "neptune"), resource.TestCheckResourceAttrSet(dataSourceName, names.AttrVersion), ), }, diff --git a/internal/service/neptune/global_cluster.go b/internal/service/neptune/global_cluster.go index 6d9280b45b0..d9bf0e1fe0e 100644 --- a/internal/service/neptune/global_cluster.go +++ b/internal/service/neptune/global_cluster.go @@ -53,12 +53,12 @@ func ResourceGlobalCluster() *schema.Resource { Optional: true, Default: false, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, - ExactlyOneOf: []string{"engine", "source_db_cluster_identifier"}, + ExactlyOneOf: []string{names.AttrEngine, "source_db_cluster_identifier"}, ValidateFunc: validation.StringInSlice(engine_Values(), false), }, names.AttrEngineVersion: { @@ -97,13 +97,13 @@ func ResourceGlobalCluster() *schema.Resource { Optional: true, Computed: true, ForceNew: true, - ExactlyOneOf: []string{"engine", "source_db_cluster_identifier"}, + ExactlyOneOf: []string{names.AttrEngine, "source_db_cluster_identifier"}, }, names.AttrStatus: { Type: schema.TypeString, Computed: true, }, - "storage_encrypted": { + names.AttrStorageEncrypted: { Type: schema.TypeBool, Optional: true, Computed: true, @@ -127,7 +127,7 @@ func resourceGlobalClusterCreate(ctx context.Context, d *schema.ResourceData, me input.DeletionProtection = aws.Bool(v.(bool)) } - if v, ok := d.GetOk("engine"); ok { + if v, ok := d.GetOk(names.AttrEngine); ok { input.Engine = aws.String(v.(string)) } @@ -139,7 +139,7 @@ func resourceGlobalClusterCreate(ctx context.Context, d *schema.ResourceData, me input.SourceDBClusterIdentifier = aws.String(v.(string)) } - if v, ok := d.GetOk("storage_encrypted"); ok { + if v, ok := d.GetOk(names.AttrStorageEncrypted); ok { input.StorageEncrypted = aws.Bool(v.(bool)) } @@ -177,14 +177,14 @@ func resourceGlobalClusterRead(ctx context.Context, d *schema.ResourceData, meta d.Set(names.AttrARN, globalCluster.GlobalClusterArn) d.Set("deletion_protection", globalCluster.DeletionProtection) - d.Set("engine", globalCluster.Engine) + d.Set(names.AttrEngine, globalCluster.Engine) d.Set(names.AttrEngineVersion, globalCluster.EngineVersion) d.Set("global_cluster_identifier", globalCluster.GlobalClusterIdentifier) if err := d.Set("global_cluster_members", flattenGlobalClusterMembers(globalCluster.GlobalClusterMembers)); err != nil { return sdkdiag.AppendErrorf(diags, "setting global_cluster_members: %s", err) } d.Set("global_cluster_resource_id", globalCluster.GlobalClusterResourceId) - d.Set("storage_encrypted", globalCluster.StorageEncrypted) + d.Set(names.AttrStorageEncrypted, globalCluster.StorageEncrypted) return diags } diff --git a/internal/service/neptune/global_cluster_test.go b/internal/service/neptune/global_cluster_test.go index 3401b9b711f..d370ad10e85 100644 --- a/internal/service/neptune/global_cluster_test.go +++ b/internal/service/neptune/global_cluster_test.go @@ -41,11 +41,11 @@ func TestAccNeptuneGlobalCluster_basic(t *testing.T) { testAccCheckGlobalClusterExists(ctx, resourceName, &v), acctest.CheckResourceAttrGlobalARN(resourceName, names.AttrARN, "rds", fmt.Sprintf("global-cluster:%s", rName)), resource.TestCheckResourceAttr(resourceName, "deletion_protection", acctest.CtFalse), - resource.TestCheckResourceAttrSet(resourceName, "engine"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEngine), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), resource.TestCheckResourceAttr(resourceName, "global_cluster_identifier", rName), resource.TestMatchResourceAttr(resourceName, "global_cluster_resource_id", regexache.MustCompile(`cluster-.+`)), - resource.TestCheckResourceAttr(resourceName, "storage_encrypted", acctest.CtFalse), + resource.TestCheckResourceAttr(resourceName, names.AttrStorageEncrypted, acctest.CtFalse), ), }, { @@ -75,11 +75,11 @@ func TestAccNeptuneGlobalCluster_completeBasic(t *testing.T) { testAccCheckGlobalClusterExists(ctx, resourceName, &v), acctest.CheckResourceAttrGlobalARN(resourceName, names.AttrARN, "rds", fmt.Sprintf("global-cluster:%s", rName)), resource.TestCheckResourceAttr(resourceName, "deletion_protection", acctest.CtFalse), - resource.TestCheckResourceAttrSet(resourceName, "engine"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEngine), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), resource.TestCheckResourceAttr(resourceName, "global_cluster_identifier", rName), resource.TestMatchResourceAttr(resourceName, "global_cluster_resource_id", regexache.MustCompile(`cluster-.+`)), - resource.TestCheckResourceAttr(resourceName, "storage_encrypted", acctest.CtFalse), + resource.TestCheckResourceAttr(resourceName, names.AttrStorageEncrypted, acctest.CtFalse), ), }, { @@ -167,7 +167,7 @@ func TestAccNeptuneGlobalCluster_Engine(t *testing.T) { Config: testAccGlobalClusterConfig_engine(rName, "neptune"), Check: resource.ComposeTestCheckFunc( testAccCheckGlobalClusterExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "engine", "neptune"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "neptune"), ), }, { @@ -292,7 +292,7 @@ func TestAccNeptuneGlobalCluster_StorageEncrypted(t *testing.T) { Config: testAccGlobalClusterConfig_storageEncrypted(rName, true), Check: resource.ComposeTestCheckFunc( testAccCheckGlobalClusterExists(ctx, resourceName, &globalCluster1), - resource.TestCheckResourceAttr(resourceName, "storage_encrypted", acctest.CtTrue), + resource.TestCheckResourceAttr(resourceName, names.AttrStorageEncrypted, acctest.CtTrue), ), }, { @@ -305,7 +305,7 @@ func TestAccNeptuneGlobalCluster_StorageEncrypted(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckGlobalClusterExists(ctx, resourceName, &globalCluster2), testAccCheckGlobalClusterRecreated(&globalCluster1, &globalCluster2), - resource.TestCheckResourceAttr(resourceName, "storage_encrypted", acctest.CtFalse), + resource.TestCheckResourceAttr(resourceName, names.AttrStorageEncrypted, acctest.CtFalse), ), }, }, diff --git a/internal/service/neptune/orderable_db_instance_data_source.go b/internal/service/neptune/orderable_db_instance_data_source.go index b4ff6be85c2..f096f383db1 100644 --- a/internal/service/neptune/orderable_db_instance_data_source.go +++ b/internal/service/neptune/orderable_db_instance_data_source.go @@ -28,7 +28,7 @@ func DataSourceOrderableDBInstance() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Optional: true, Default: engineNeptune, @@ -130,7 +130,7 @@ func dataSourceOrderableDBInstanceRead(ctx context.Context, d *schema.ResourceDa input.DBInstanceClass = aws.String(v.(string)) } - if v, ok := d.GetOk("engine"); ok { + if v, ok := d.GetOk(names.AttrEngine); ok { input.Engine = aws.String(v.(string)) } @@ -179,7 +179,7 @@ func dataSourceOrderableDBInstanceRead(ctx context.Context, d *schema.ResourceDa d.Set(names.AttrAvailabilityZones, tfslices.ApplyToAll(orderableDBInstance.AvailabilityZones, func(v *neptune.AvailabilityZone) string { return aws.StringValue(v.Name) })) - d.Set("engine", orderableDBInstance.Engine) + d.Set(names.AttrEngine, orderableDBInstance.Engine) d.Set(names.AttrEngineVersion, orderableDBInstance.EngineVersion) d.Set("license_model", orderableDBInstance.LicenseModel) d.Set("max_iops_per_db_instance", orderableDBInstance.MaxIopsPerDbInstance) diff --git a/internal/service/neptune/orderable_db_instance_data_source_test.go b/internal/service/neptune/orderable_db_instance_data_source_test.go index f2dd568584e..aadb88bf5a9 100644 --- a/internal/service/neptune/orderable_db_instance_data_source_test.go +++ b/internal/service/neptune/orderable_db_instance_data_source_test.go @@ -32,7 +32,7 @@ func TestAccNeptuneOrderableDBInstanceDataSource_basic(t *testing.T) { { Config: testAccOrderableDBInstanceDataSourceConfig_basic(class, engine, engineVersion, licenseModel), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(dataSourceName, "engine", engine), + resource.TestCheckResourceAttr(dataSourceName, names.AttrEngine, engine), resource.TestCheckResourceAttr(dataSourceName, names.AttrEngineVersion, engineVersion), resource.TestCheckResourceAttr(dataSourceName, "license_model", licenseModel), resource.TestCheckResourceAttr(dataSourceName, "instance_class", class), @@ -58,7 +58,7 @@ func TestAccNeptuneOrderableDBInstanceDataSource_preferred(t *testing.T) { { Config: testAccOrderableDBInstanceDataSourceConfig_preferred(engine, engineVersion, licenseModel, preferredOption), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(dataSourceName, "engine", engine), + resource.TestCheckResourceAttr(dataSourceName, names.AttrEngine, engine), resource.TestCheckResourceAttr(dataSourceName, names.AttrEngineVersion, engineVersion), resource.TestCheckResourceAttr(dataSourceName, "license_model", licenseModel), resource.TestCheckResourceAttr(dataSourceName, "instance_class", preferredOption), diff --git a/internal/service/networkmanager/attachment_accepter.go b/internal/service/networkmanager/attachment_accepter.go index f2b14610d72..0e90cbd3655 100644 --- a/internal/service/networkmanager/attachment_accepter.go +++ b/internal/service/networkmanager/attachment_accepter.go @@ -64,7 +64,7 @@ func ResourceAttachmentAccepter() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "owner_account_id": { + names.AttrOwnerAccountID: { Type: schema.TypeString, Computed: true, }, @@ -252,7 +252,7 @@ func resourceAttachmentAccepterRead(ctx context.Context, d *schema.ResourceData, d.Set("core_network_arn", a.CoreNetworkArn) d.Set("core_network_id", a.CoreNetworkId) d.Set("edge_location", a.EdgeLocation) - d.Set("owner_account_id", a.OwnerAccountId) + d.Set(names.AttrOwnerAccountID, a.OwnerAccountId) d.Set(names.AttrResourceARN, a.ResourceArn) d.Set("segment_name", a.SegmentName) d.Set(names.AttrState, a.State) diff --git a/internal/service/networkmanager/connect_attachment.go b/internal/service/networkmanager/connect_attachment.go index 7068c4b2a7e..d443ff0cccd 100644 --- a/internal/service/networkmanager/connect_attachment.go +++ b/internal/service/networkmanager/connect_attachment.go @@ -99,7 +99,7 @@ func ResourceConnectAttachment() *schema.Resource { }, }, }, - "owner_account_id": { + names.AttrOwnerAccountID: { Type: schema.TypeString, Computed: true, }, @@ -231,7 +231,7 @@ func resourceConnectAttachmentRead(ctx context.Context, d *schema.ResourceData, } else { d.Set("options", nil) } - d.Set("owner_account_id", a.OwnerAccountId) + d.Set(names.AttrOwnerAccountID, a.OwnerAccountId) d.Set(names.AttrResourceARN, a.ResourceArn) d.Set("segment_name", a.SegmentName) d.Set(names.AttrState, a.State) diff --git a/internal/service/networkmanager/connect_attachment_test.go b/internal/service/networkmanager/connect_attachment_test.go index a82817d42ce..39fbd27998b 100644 --- a/internal/service/networkmanager/connect_attachment_test.go +++ b/internal/service/networkmanager/connect_attachment_test.go @@ -41,7 +41,7 @@ func TestAccNetworkManagerConnectAttachment_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "core_network_id"), resource.TestCheckResourceAttr(resourceName, "edge_location", acctest.Region()), resource.TestCheckResourceAttr(resourceName, "options.0.protocol", "GRE"), - acctest.CheckResourceAttrAccountID(resourceName, "owner_account_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrOwnerAccountID), resource.TestCheckResourceAttr(resourceName, "segment_name", "shared"), resource.TestCheckResourceAttrSet(resourceName, names.AttrState), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct1), @@ -77,7 +77,7 @@ func TestAccNetworkManagerConnectAttachment_basic_NoDependsOn(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "core_network_id"), resource.TestCheckResourceAttr(resourceName, "edge_location", acctest.Region()), resource.TestCheckResourceAttr(resourceName, "options.0.protocol", "GRE"), - acctest.CheckResourceAttrAccountID(resourceName, "owner_account_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrOwnerAccountID), resource.TestCheckResourceAttr(resourceName, "segment_name", "shared"), resource.TestCheckResourceAttrSet(resourceName, names.AttrState), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct1), @@ -137,7 +137,7 @@ func TestAccNetworkManagerConnectAttachment_protocolNoEncap(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "core_network_id"), resource.TestCheckResourceAttr(resourceName, "edge_location", acctest.Region()), resource.TestCheckResourceAttr(resourceName, "options.0.protocol", "NO_ENCAP"), - acctest.CheckResourceAttrAccountID(resourceName, "owner_account_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrOwnerAccountID), resource.TestCheckResourceAttr(resourceName, "segment_name", "shared"), resource.TestCheckResourceAttrSet(resourceName, names.AttrState), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct1), diff --git a/internal/service/networkmanager/site_to_site_vpn_attachment.go b/internal/service/networkmanager/site_to_site_vpn_attachment.go index d4a7e71541f..e2915be4864 100644 --- a/internal/service/networkmanager/site_to_site_vpn_attachment.go +++ b/internal/service/networkmanager/site_to_site_vpn_attachment.go @@ -73,7 +73,7 @@ func ResourceSiteToSiteVPNAttachment() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "owner_account_id": { + names.AttrOwnerAccountID: { Type: schema.TypeString, Computed: true, }, @@ -159,7 +159,7 @@ func resourceSiteToSiteVPNAttachmentRead(ctx context.Context, d *schema.Resource d.Set("core_network_arn", a.CoreNetworkArn) d.Set("core_network_id", a.CoreNetworkId) d.Set("edge_location", a.EdgeLocation) - d.Set("owner_account_id", a.OwnerAccountId) + d.Set(names.AttrOwnerAccountID, a.OwnerAccountId) d.Set(names.AttrResourceARN, a.ResourceArn) d.Set("segment_name", a.SegmentName) d.Set(names.AttrState, a.State) diff --git a/internal/service/networkmanager/site_to_site_vpn_attachment_test.go b/internal/service/networkmanager/site_to_site_vpn_attachment_test.go index 1ada417d382..db6b8b8949a 100644 --- a/internal/service/networkmanager/site_to_site_vpn_attachment_test.go +++ b/internal/service/networkmanager/site_to_site_vpn_attachment_test.go @@ -49,7 +49,7 @@ func TestAccNetworkManagerSiteToSiteVPNAttachment_basic(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "core_network_arn", coreNetworkResourceName, names.AttrARN), resource.TestCheckResourceAttrSet(resourceName, "core_network_id"), resource.TestCheckResourceAttr(resourceName, "edge_location", acctest.Region()), - acctest.CheckResourceAttrAccountID(resourceName, "owner_account_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrOwnerAccountID), resource.TestCheckResourceAttrPair(resourceName, names.AttrResourceARN, vpnResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "segment_name", "shared"), resource.TestCheckResourceAttrSet(resourceName, names.AttrState), diff --git a/internal/service/networkmanager/transit_gateway_peering.go b/internal/service/networkmanager/transit_gateway_peering.go index f2b5b5e42f5..4d9972dc856 100644 --- a/internal/service/networkmanager/transit_gateway_peering.go +++ b/internal/service/networkmanager/transit_gateway_peering.go @@ -62,7 +62,7 @@ func ResourceTransitGatewayPeering() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "owner_account_id": { + names.AttrOwnerAccountID: { Type: schema.TypeString, Computed: true, }, @@ -147,7 +147,7 @@ func resourceTransitGatewayPeeringRead(ctx context.Context, d *schema.ResourceDa d.Set("core_network_arn", p.CoreNetworkArn) d.Set("core_network_id", p.CoreNetworkId) d.Set("edge_location", p.EdgeLocation) - d.Set("owner_account_id", p.OwnerAccountId) + d.Set(names.AttrOwnerAccountID, p.OwnerAccountId) d.Set("peering_type", p.PeeringType) d.Set(names.AttrResourceARN, p.ResourceArn) d.Set("transit_gateway_arn", transitGatewayPeering.TransitGatewayArn) diff --git a/internal/service/networkmanager/transit_gateway_peering_test.go b/internal/service/networkmanager/transit_gateway_peering_test.go index 7d320d2b16c..e455d4970cb 100644 --- a/internal/service/networkmanager/transit_gateway_peering_test.go +++ b/internal/service/networkmanager/transit_gateway_peering_test.go @@ -51,7 +51,7 @@ func TestAccNetworkManagerTransitGatewayPeering_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "core_network_arn"), resource.TestCheckResourceAttrSet(resourceName, "core_network_id"), resource.TestCheckResourceAttr(resourceName, "edge_location", acctest.Region()), - acctest.CheckResourceAttrAccountID(resourceName, "owner_account_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrOwnerAccountID), resource.TestCheckResourceAttrPair(resourceName, names.AttrResourceARN, tgwResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct0), resource.TestCheckResourceAttrPair(resourceName, "transit_gateway_arn", tgwResourceName, names.AttrARN), diff --git a/internal/service/networkmanager/transit_gateway_route_table_attachment.go b/internal/service/networkmanager/transit_gateway_route_table_attachment.go index d9039fee4cc..90d18e1991a 100644 --- a/internal/service/networkmanager/transit_gateway_route_table_attachment.go +++ b/internal/service/networkmanager/transit_gateway_route_table_attachment.go @@ -69,7 +69,7 @@ func ResourceTransitGatewayRouteTableAttachment() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "owner_account_id": { + names.AttrOwnerAccountID: { Type: schema.TypeString, Computed: true, }, @@ -161,7 +161,7 @@ func resourceTransitGatewayRouteTableAttachmentRead(ctx context.Context, d *sche d.Set("core_network_arn", a.CoreNetworkArn) d.Set("core_network_id", a.CoreNetworkId) d.Set("edge_location", a.EdgeLocation) - d.Set("owner_account_id", a.OwnerAccountId) + d.Set(names.AttrOwnerAccountID, a.OwnerAccountId) d.Set("peering_id", transitGatewayRouteTableAttachment.PeeringId) d.Set(names.AttrResourceARN, a.ResourceArn) d.Set("segment_name", a.SegmentName) diff --git a/internal/service/networkmanager/transit_gateway_route_table_attachment_test.go b/internal/service/networkmanager/transit_gateway_route_table_attachment_test.go index 821c56605d2..8fab8ff8eb6 100644 --- a/internal/service/networkmanager/transit_gateway_route_table_attachment_test.go +++ b/internal/service/networkmanager/transit_gateway_route_table_attachment_test.go @@ -40,7 +40,7 @@ func TestAccNetworkManagerTransitGatewayRouteTableAttachment_basic(t *testing.T) resource.TestCheckResourceAttr(resourceName, "attachment_policy_rule_number", acctest.Ct0), resource.TestCheckResourceAttr(resourceName, "attachment_type", "TRANSIT_GATEWAY_ROUTE_TABLE"), resource.TestCheckResourceAttr(resourceName, "edge_location", acctest.Region()), - acctest.CheckResourceAttrAccountID(resourceName, "owner_account_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrOwnerAccountID), resource.TestCheckResourceAttrSet(resourceName, names.AttrResourceARN), resource.TestCheckResourceAttr(resourceName, "segment_name", ""), resource.TestCheckResourceAttrSet(resourceName, names.AttrState), diff --git a/internal/service/networkmanager/vpc_attachment.go b/internal/service/networkmanager/vpc_attachment.go index 89f178bf908..e83fb9cb7d2 100644 --- a/internal/service/networkmanager/vpc_attachment.go +++ b/internal/service/networkmanager/vpc_attachment.go @@ -121,7 +121,7 @@ func ResourceVPCAttachment() *schema.Resource { }, DiffSuppressFunc: verify.SuppressMissingOptionalConfigurationBlock, }, - "owner_account_id": { + names.AttrOwnerAccountID: { Type: schema.TypeString, Computed: true, }, @@ -228,7 +228,7 @@ func resourceVPCAttachmentRead(ctx context.Context, d *schema.ResourceData, meta } else { d.Set("options", nil) } - d.Set("owner_account_id", a.OwnerAccountId) + d.Set(names.AttrOwnerAccountID, a.OwnerAccountId) d.Set(names.AttrResourceARN, a.ResourceArn) d.Set("segment_name", a.SegmentName) d.Set(names.AttrState, a.State) diff --git a/internal/service/networkmanager/vpc_attachment_test.go b/internal/service/networkmanager/vpc_attachment_test.go index 80b74acd709..e92dc3edfde 100644 --- a/internal/service/networkmanager/vpc_attachment_test.go +++ b/internal/service/networkmanager/vpc_attachment_test.go @@ -73,7 +73,7 @@ func TestAccNetworkManagerVPCAttachment_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "options.#", acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "options.0.appliance_mode_support", acctest.CtFalse), resource.TestCheckResourceAttr(resourceName, "options.0.ipv6_support", acctest.CtFalse), - acctest.CheckResourceAttrAccountID(resourceName, "owner_account_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrOwnerAccountID), resource.TestCheckResourceAttrPair(resourceName, names.AttrResourceARN, vpcResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "segment_name", "shared"), resource.TestCheckResourceAttr(resourceName, names.AttrState, testcase.expectedState), @@ -141,7 +141,7 @@ func TestAccNetworkManagerVPCAttachment_Attached_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "options.#", acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "options.0.appliance_mode_support", acctest.CtFalse), resource.TestCheckResourceAttr(resourceName, "options.0.ipv6_support", acctest.CtFalse), - acctest.CheckResourceAttrAccountID(resourceName, "owner_account_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrOwnerAccountID), resource.TestCheckResourceAttrPair(resourceName, names.AttrResourceARN, vpcResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "segment_name", "shared"), resource.TestCheckResourceAttrSet(resourceName, names.AttrState), diff --git a/internal/service/opensearch/domain.go b/internal/service/opensearch/domain.go index 661f2653670..94bdb3295fe 100644 --- a/internal/service/opensearch/domain.go +++ b/internal/service/opensearch/domain.go @@ -414,7 +414,7 @@ func ResourceDomain() *schema.Resource { Optional: true, Computed: true, }, - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Optional: true, Computed: true, diff --git a/internal/service/opensearch/domain_data_source.go b/internal/service/opensearch/domain_data_source.go index 617b9efa99a..6a2b174b49f 100644 --- a/internal/service/opensearch/domain_data_source.go +++ b/internal/service/opensearch/domain_data_source.go @@ -238,7 +238,7 @@ func DataSourceDomain() *schema.Resource { Type: schema.TypeInt, Computed: true, }, - "throughput": { + names.AttrThroughput: { Type: schema.TypeInt, Computed: true, }, diff --git a/internal/service/opensearch/flex.go b/internal/service/opensearch/flex.go index d993c01aa8d..a731ef1a84e 100644 --- a/internal/service/opensearch/flex.go +++ b/internal/service/opensearch/flex.go @@ -92,7 +92,7 @@ func expandEBSOptions(m map[string]interface{}) *opensearchservice.EBSOptions { if v, ok := m[names.AttrIOPS]; ok && v.(int) > 0 && EBSVolumeTypePermitsIopsInput(volumeType) { options.Iops = aws.Int64(int64(v.(int))) } - if v, ok := m["throughput"]; ok && v.(int) > 0 && EBSVolumeTypePermitsThroughputInput(volumeType) { + if v, ok := m[names.AttrThroughput]; ok && v.(int) > 0 && EBSVolumeTypePermitsThroughputInput(volumeType) { options.Throughput = aws.Int64(int64(v.(int))) } } @@ -162,7 +162,7 @@ func flattenEBSOptions(o *opensearchservice.EBSOptions) []map[string]interface{} m[names.AttrIOPS] = aws.Int64Value(o.Iops) } if o.Throughput != nil { - m["throughput"] = aws.Int64Value(o.Throughput) + m[names.AttrThroughput] = aws.Int64Value(o.Throughput) } if o.VolumeSize != nil { m[names.AttrVolumeSize] = aws.Int64Value(o.VolumeSize) diff --git a/internal/service/pinpoint/adm_channel.go b/internal/service/pinpoint/adm_channel.go index dd3cd3f08d6..3ad66b15b43 100644 --- a/internal/service/pinpoint/adm_channel.go +++ b/internal/service/pinpoint/adm_channel.go @@ -29,7 +29,7 @@ func ResourceADMChannel() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "application_id": { + names.AttrApplicationID: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -57,7 +57,7 @@ func resourceADMChannelUpsert(ctx context.Context, d *schema.ResourceData, meta var diags diag.Diagnostics conn := meta.(*conns.AWSClient).PinpointConn(ctx) - applicationId := d.Get("application_id").(string) + applicationId := d.Get(names.AttrApplicationID).(string) params := &pinpoint.ADMChannelRequest{} @@ -99,7 +99,7 @@ func resourceADMChannelRead(ctx context.Context, d *schema.ResourceData, meta in return sdkdiag.AppendErrorf(diags, "getting Pinpoint ADM Channel for application %s: %s", d.Id(), err) } - d.Set("application_id", channel.ADMChannelResponse.ApplicationId) + d.Set(names.AttrApplicationID, channel.ADMChannelResponse.ApplicationId) d.Set(names.AttrEnabled, channel.ADMChannelResponse.Enabled) // client_id and client_secret are never returned diff --git a/internal/service/pinpoint/apns_channel.go b/internal/service/pinpoint/apns_channel.go index eb64b8a3a65..e13de5ec550 100644 --- a/internal/service/pinpoint/apns_channel.go +++ b/internal/service/pinpoint/apns_channel.go @@ -29,7 +29,7 @@ func ResourceAPNSChannel() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "application_id": { + names.AttrApplicationID: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -93,7 +93,7 @@ func resourceAPNSChannelUpsert(ctx context.Context, d *schema.ResourceData, meta conn := meta.(*conns.AWSClient).PinpointConn(ctx) - applicationId := d.Get("application_id").(string) + applicationId := d.Get(names.AttrApplicationID).(string) params := &pinpoint.APNSChannelRequest{} @@ -142,7 +142,7 @@ func resourceAPNSChannelRead(ctx context.Context, d *schema.ResourceData, meta i return sdkdiag.AppendErrorf(diags, "getting Pinpoint APNs Channel for application %s: %s", d.Id(), err) } - d.Set("application_id", output.APNSChannelResponse.ApplicationId) + d.Set(names.AttrApplicationID, output.APNSChannelResponse.ApplicationId) d.Set("default_authentication_method", output.APNSChannelResponse.DefaultAuthenticationMethod) d.Set(names.AttrEnabled, output.APNSChannelResponse.Enabled) // Sensitive params are not returned diff --git a/internal/service/pinpoint/apns_sandbox_channel.go b/internal/service/pinpoint/apns_sandbox_channel.go index 3a7ed6ec1a5..d9df7ab4e25 100644 --- a/internal/service/pinpoint/apns_sandbox_channel.go +++ b/internal/service/pinpoint/apns_sandbox_channel.go @@ -29,7 +29,7 @@ func ResourceAPNSSandboxChannel() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "application_id": { + names.AttrApplicationID: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -93,7 +93,7 @@ func resourceAPNSSandboxChannelUpsert(ctx context.Context, d *schema.ResourceDat conn := meta.(*conns.AWSClient).PinpointConn(ctx) - applicationId := d.Get("application_id").(string) + applicationId := d.Get(names.AttrApplicationID).(string) params := &pinpoint.APNSSandboxChannelRequest{} @@ -142,7 +142,7 @@ func resourceAPNSSandboxChannelRead(ctx context.Context, d *schema.ResourceData, return sdkdiag.AppendErrorf(diags, "getting Pinpoint APNs Sandbox Channel for application %s: %s", d.Id(), err) } - d.Set("application_id", output.APNSSandboxChannelResponse.ApplicationId) + d.Set(names.AttrApplicationID, output.APNSSandboxChannelResponse.ApplicationId) d.Set("default_authentication_method", output.APNSSandboxChannelResponse.DefaultAuthenticationMethod) d.Set(names.AttrEnabled, output.APNSSandboxChannelResponse.Enabled) // Sensitive params are not returned diff --git a/internal/service/pinpoint/apns_voip_channel.go b/internal/service/pinpoint/apns_voip_channel.go index 9e855cadf5e..c25ddabff0b 100644 --- a/internal/service/pinpoint/apns_voip_channel.go +++ b/internal/service/pinpoint/apns_voip_channel.go @@ -29,7 +29,7 @@ func ResourceAPNSVoIPChannel() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "application_id": { + names.AttrApplicationID: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -93,7 +93,7 @@ func resourceAPNSVoIPChannelUpsert(ctx context.Context, d *schema.ResourceData, conn := meta.(*conns.AWSClient).PinpointConn(ctx) - applicationId := d.Get("application_id").(string) + applicationId := d.Get(names.AttrApplicationID).(string) params := &pinpoint.APNSVoipChannelRequest{} @@ -142,7 +142,7 @@ func resourceAPNSVoIPChannelRead(ctx context.Context, d *schema.ResourceData, me return sdkdiag.AppendErrorf(diags, "getting Pinpoint APNs Voip Channel for application %s: %s", d.Id(), err) } - d.Set("application_id", output.APNSVoipChannelResponse.ApplicationId) + d.Set(names.AttrApplicationID, output.APNSVoipChannelResponse.ApplicationId) d.Set("default_authentication_method", output.APNSVoipChannelResponse.DefaultAuthenticationMethod) d.Set(names.AttrEnabled, output.APNSVoipChannelResponse.Enabled) // Sensitive params are not returned diff --git a/internal/service/pinpoint/apns_voip_sandbox_channel.go b/internal/service/pinpoint/apns_voip_sandbox_channel.go index e2e1c26ed7d..39bfc6abe34 100644 --- a/internal/service/pinpoint/apns_voip_sandbox_channel.go +++ b/internal/service/pinpoint/apns_voip_sandbox_channel.go @@ -29,7 +29,7 @@ func ResourceAPNSVoIPSandboxChannel() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "application_id": { + names.AttrApplicationID: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -93,7 +93,7 @@ func resourceAPNSVoIPSandboxChannelUpsert(ctx context.Context, d *schema.Resourc conn := meta.(*conns.AWSClient).PinpointConn(ctx) - applicationId := d.Get("application_id").(string) + applicationId := d.Get(names.AttrApplicationID).(string) params := &pinpoint.APNSVoipSandboxChannelRequest{} @@ -142,7 +142,7 @@ func resourceAPNSVoIPSandboxChannelRead(ctx context.Context, d *schema.ResourceD return sdkdiag.AppendErrorf(diags, "getting Pinpoint APNs Voip Sandbox Channel for application %s: %s", d.Id(), err) } - d.Set("application_id", output.APNSVoipSandboxChannelResponse.ApplicationId) + d.Set(names.AttrApplicationID, output.APNSVoipSandboxChannelResponse.ApplicationId) d.Set("default_authentication_method", output.APNSVoipSandboxChannelResponse.DefaultAuthenticationMethod) d.Set(names.AttrEnabled, output.APNSVoipSandboxChannelResponse.Enabled) // Sensitive params are not returned diff --git a/internal/service/pinpoint/app.go b/internal/service/pinpoint/app.go index 082609c0cae..944572ad808 100644 --- a/internal/service/pinpoint/app.go +++ b/internal/service/pinpoint/app.go @@ -36,7 +36,7 @@ func ResourceApp() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "application_id": { + names.AttrApplicationID: { Type: schema.TypeString, Computed: true, }, @@ -187,7 +187,7 @@ func resourceAppRead(ctx context.Context, d *schema.ResourceData, meta interface return sdkdiag.AppendErrorf(diags, "reading Pinpoint App (%s) settings: %s", d.Id(), err) } - d.Set("application_id", app.Id) + d.Set(names.AttrApplicationID, app.Id) d.Set(names.AttrARN, app.Arn) if err := d.Set("campaign_hook", flattenCampaignHook(settings.CampaignHook)); err != nil { return sdkdiag.AppendErrorf(diags, "setting campaign_hook: %s", err) diff --git a/internal/service/pinpoint/app_test.go b/internal/service/pinpoint/app_test.go index 72a34ef6277..07986bb497c 100644 --- a/internal/service/pinpoint/app_test.go +++ b/internal/service/pinpoint/app_test.go @@ -36,7 +36,7 @@ func TestAccPinpointApp_basic(t *testing.T) { Config: testAccAppConfig_basic(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckAppExists(ctx, resourceName, &application), - resource.TestCheckResourceAttrSet(resourceName, "application_id"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrApplicationID), resource.TestCheckResourceAttrSet(resourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "campaign_hook.#", acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "limits.#", acctest.Ct1), diff --git a/internal/service/pinpoint/baidu_channel.go b/internal/service/pinpoint/baidu_channel.go index c64caa91c18..9ceb08c9432 100644 --- a/internal/service/pinpoint/baidu_channel.go +++ b/internal/service/pinpoint/baidu_channel.go @@ -29,7 +29,7 @@ func ResourceBaiduChannel() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "application_id": { + names.AttrApplicationID: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -57,7 +57,7 @@ func resourceBaiduChannelUpsert(ctx context.Context, d *schema.ResourceData, met var diags diag.Diagnostics conn := meta.(*conns.AWSClient).PinpointConn(ctx) - applicationId := d.Get("application_id").(string) + applicationId := d.Get(names.AttrApplicationID).(string) params := &pinpoint.BaiduChannelRequest{} @@ -99,7 +99,7 @@ func resourceBaiduChannelRead(ctx context.Context, d *schema.ResourceData, meta return sdkdiag.AppendErrorf(diags, "getting Pinpoint Baidu Channel for application %s: %s", d.Id(), err) } - d.Set("application_id", output.BaiduChannelResponse.ApplicationId) + d.Set(names.AttrApplicationID, output.BaiduChannelResponse.ApplicationId) d.Set(names.AttrEnabled, output.BaiduChannelResponse.Enabled) // ApiKey and SecretKey are never returned diff --git a/internal/service/pinpoint/email_channel.go b/internal/service/pinpoint/email_channel.go index 427e50e0173..0e8adbc4d18 100644 --- a/internal/service/pinpoint/email_channel.go +++ b/internal/service/pinpoint/email_channel.go @@ -30,7 +30,7 @@ func ResourceEmailChannel() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "application_id": { + names.AttrApplicationID: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -70,7 +70,7 @@ func resourceEmailChannelUpsert(ctx context.Context, d *schema.ResourceData, met var diags diag.Diagnostics conn := meta.(*conns.AWSClient).PinpointConn(ctx) - applicationId := d.Get("application_id").(string) + applicationId := d.Get(names.AttrApplicationID).(string) params := &pinpoint.EmailChannelRequest{} @@ -121,7 +121,7 @@ func resourceEmailChannelRead(ctx context.Context, d *schema.ResourceData, meta } res := output.EmailChannelResponse - d.Set("application_id", res.ApplicationId) + d.Set(names.AttrApplicationID, res.ApplicationId) d.Set(names.AttrEnabled, res.Enabled) d.Set("from_address", res.FromAddress) d.Set("identity", res.Identity) diff --git a/internal/service/pinpoint/event_stream.go b/internal/service/pinpoint/event_stream.go index f0db33fc7bd..c3a8d70c1ac 100644 --- a/internal/service/pinpoint/event_stream.go +++ b/internal/service/pinpoint/event_stream.go @@ -32,7 +32,7 @@ func ResourceEventStream() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "application_id": { + names.AttrApplicationID: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -55,7 +55,7 @@ func resourceEventStreamUpsert(ctx context.Context, d *schema.ResourceData, meta var diags diag.Diagnostics conn := meta.(*conns.AWSClient).PinpointConn(ctx) - applicationId := d.Get("application_id").(string) + applicationId := d.Get(names.AttrApplicationID).(string) params := &pinpoint.WriteEventStream{ DestinationStreamArn: aws.String(d.Get("destination_stream_arn").(string)), @@ -115,7 +115,7 @@ func resourceEventStreamRead(ctx context.Context, d *schema.ResourceData, meta i } res := output.EventStream - d.Set("application_id", res.ApplicationId) + d.Set(names.AttrApplicationID, res.ApplicationId) d.Set("destination_stream_arn", res.DestinationStreamArn) d.Set(names.AttrRoleARN, res.RoleArn) diff --git a/internal/service/pinpoint/event_stream_test.go b/internal/service/pinpoint/event_stream_test.go index 32330deaf67..5c0926f72de 100644 --- a/internal/service/pinpoint/event_stream_test.go +++ b/internal/service/pinpoint/event_stream_test.go @@ -37,7 +37,7 @@ func TestAccPinpointEventStream_basic(t *testing.T) { Config: testAccEventStreamConfig_basic(rName, rName), Check: resource.ComposeTestCheckFunc( testAccCheckEventStreamExists(ctx, resourceName, &stream), - resource.TestCheckResourceAttrPair(resourceName, "application_id", "aws_pinpoint_app.test", "application_id"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrApplicationID, "aws_pinpoint_app.test", names.AttrApplicationID), resource.TestCheckResourceAttrPair(resourceName, "destination_stream_arn", "aws_kinesis_stream.test", names.AttrARN), resource.TestCheckResourceAttrPair(resourceName, names.AttrRoleARN, "aws_iam_role.test", names.AttrARN), ), @@ -51,7 +51,7 @@ func TestAccPinpointEventStream_basic(t *testing.T) { Config: testAccEventStreamConfig_basic(rName, rName2), Check: resource.ComposeTestCheckFunc( testAccCheckEventStreamExists(ctx, resourceName, &stream), - resource.TestCheckResourceAttrPair(resourceName, "application_id", "aws_pinpoint_app.test", "application_id"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrApplicationID, "aws_pinpoint_app.test", names.AttrApplicationID), resource.TestCheckResourceAttrPair(resourceName, "destination_stream_arn", "aws_kinesis_stream.test", names.AttrARN), resource.TestCheckResourceAttrPair(resourceName, names.AttrRoleARN, "aws_iam_role.test", names.AttrARN), ), diff --git a/internal/service/pinpoint/gcm_channel.go b/internal/service/pinpoint/gcm_channel.go index 57bd657f280..a4770ebddf1 100644 --- a/internal/service/pinpoint/gcm_channel.go +++ b/internal/service/pinpoint/gcm_channel.go @@ -29,7 +29,7 @@ func ResourceGCMChannel() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "application_id": { + names.AttrApplicationID: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -52,7 +52,7 @@ func resourceGCMChannelUpsert(ctx context.Context, d *schema.ResourceData, meta var diags diag.Diagnostics conn := meta.(*conns.AWSClient).PinpointConn(ctx) - applicationId := d.Get("application_id").(string) + applicationId := d.Get(names.AttrApplicationID).(string) params := &pinpoint.GCMChannelRequest{} @@ -93,7 +93,7 @@ func resourceGCMChannelRead(ctx context.Context, d *schema.ResourceData, meta in return sdkdiag.AppendErrorf(diags, "getting Pinpoint GCM Channel for application %s: %s", d.Id(), err) } - d.Set("application_id", output.GCMChannelResponse.ApplicationId) + d.Set(names.AttrApplicationID, output.GCMChannelResponse.ApplicationId) d.Set(names.AttrEnabled, output.GCMChannelResponse.Enabled) // api_key is never returned diff --git a/internal/service/pinpoint/sms_channel.go b/internal/service/pinpoint/sms_channel.go index d2c68d141f8..9a25427432f 100644 --- a/internal/service/pinpoint/sms_channel.go +++ b/internal/service/pinpoint/sms_channel.go @@ -29,7 +29,7 @@ func ResourceSMSChannel() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "application_id": { + names.AttrApplicationID: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -63,7 +63,7 @@ func resourceSMSChannelUpsert(ctx context.Context, d *schema.ResourceData, meta var diags diag.Diagnostics conn := meta.(*conns.AWSClient).PinpointConn(ctx) - applicationId := d.Get("application_id").(string) + applicationId := d.Get(names.AttrApplicationID).(string) params := &pinpoint.SMSChannelRequest{ Enabled: aws.Bool(d.Get(names.AttrEnabled).(bool)), @@ -112,7 +112,7 @@ func resourceSMSChannelRead(ctx context.Context, d *schema.ResourceData, meta in } res := output.SMSChannelResponse - d.Set("application_id", res.ApplicationId) + d.Set(names.AttrApplicationID, res.ApplicationId) d.Set(names.AttrEnabled, res.Enabled) d.Set("sender_id", res.SenderId) d.Set("short_code", res.ShortCode) diff --git a/internal/service/polly/voices_data_source.go b/internal/service/polly/voices_data_source.go index ce8aba98128..c7634746c84 100644 --- a/internal/service/polly/voices_data_source.go +++ b/internal/service/polly/voices_data_source.go @@ -38,7 +38,7 @@ func (d *dataSourceVoices) Metadata(_ context.Context, req datasource.MetadataRe func (d *dataSourceVoices) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ - "engine": schema.StringAttribute{ + names.AttrEngine: schema.StringAttribute{ CustomType: fwtypes.StringEnumType[awstypes.Engine](), Optional: true, }, diff --git a/internal/service/quicksight/account_subscription.go b/internal/service/quicksight/account_subscription.go index 3e61adfa59b..465f0c05bac 100644 --- a/internal/service/quicksight/account_subscription.go +++ b/internal/service/quicksight/account_subscription.go @@ -74,7 +74,7 @@ func ResourceAccountSubscription() *schema.Resource { Elem: &schema.Schema{Type: schema.TypeString}, ForceNew: true, }, - "aws_account_id": { + names.AttrAWSAccountID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -142,7 +142,7 @@ func resourceAccountSubscriptionCreate(ctx context.Context, d *schema.ResourceDa conn := meta.(*conns.AWSClient).QuickSightConn(ctx) awsAccountId := meta.(*conns.AWSClient).AccountID - if v, ok := d.GetOk("aws_account_id"); ok { + if v, ok := d.GetOk(names.AttrAWSAccountID); ok { awsAccountId = v.(string) } diff --git a/internal/service/quicksight/analysis.go b/internal/service/quicksight/analysis.go index 675aa1ffaf1..ba9dc0c350a 100644 --- a/internal/service/quicksight/analysis.go +++ b/internal/service/quicksight/analysis.go @@ -60,7 +60,7 @@ func ResourceAnalysis() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "aws_account_id": { + names.AttrAWSAccountID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -148,7 +148,7 @@ func resourceAnalysisCreate(ctx context.Context, d *schema.ResourceData, meta in conn := meta.(*conns.AWSClient).QuickSightConn(ctx) awsAccountId := meta.(*conns.AWSClient).AccountID - if v, ok := d.GetOk("aws_account_id"); ok { + if v, ok := d.GetOk(names.AttrAWSAccountID); ok { awsAccountId = v.(string) } analysisId := d.Get("analysis_id").(string) @@ -218,7 +218,7 @@ func resourceAnalysisRead(ctx context.Context, d *schema.ResourceData, meta inte } d.Set(names.AttrARN, out.Arn) - d.Set("aws_account_id", awsAccountId) + d.Set(names.AttrAWSAccountID, awsAccountId) d.Set(names.AttrCreatedTime, out.CreatedTime.Format(time.RFC3339)) d.Set("last_updated_time", out.LastUpdatedTime.Format(time.RFC3339)) d.Set(names.AttrName, out.Name) diff --git a/internal/service/quicksight/dashboard.go b/internal/service/quicksight/dashboard.go index 9eb7a05eee4..541a4022e23 100644 --- a/internal/service/quicksight/dashboard.go +++ b/internal/service/quicksight/dashboard.go @@ -52,7 +52,7 @@ func ResourceDashboard() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "aws_account_id": { + names.AttrAWSAccountID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -146,7 +146,7 @@ func resourceDashboardCreate(ctx context.Context, d *schema.ResourceData, meta i conn := meta.(*conns.AWSClient).QuickSightConn(ctx) awsAccountId := meta.(*conns.AWSClient).AccountID - if v, ok := d.GetOk("aws_account_id"); ok { + if v, ok := d.GetOk(names.AttrAWSAccountID); ok { awsAccountId = v.(string) } dashboardId := d.Get("dashboard_id").(string) @@ -217,7 +217,7 @@ func resourceDashboardRead(ctx context.Context, d *schema.ResourceData, meta int } d.Set(names.AttrARN, out.Arn) - d.Set("aws_account_id", awsAccountId) + d.Set(names.AttrAWSAccountID, awsAccountId) d.Set(names.AttrCreatedTime, out.CreatedTime.Format(time.RFC3339)) d.Set("last_updated_time", out.LastUpdatedTime.Format(time.RFC3339)) d.Set(names.AttrName, out.Name) diff --git a/internal/service/quicksight/data_set.go b/internal/service/quicksight/data_set.go index 5bdcd476a59..62d99b7b3c4 100644 --- a/internal/service/quicksight/data_set.go +++ b/internal/service/quicksight/data_set.go @@ -44,7 +44,7 @@ func ResourceDataSet() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "aws_account_id": { + names.AttrAWSAccountID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -841,7 +841,7 @@ func resourceDataSetCreate(ctx context.Context, d *schema.ResourceData, meta int conn := meta.(*conns.AWSClient).QuickSightConn(ctx) awsAccountId := meta.(*conns.AWSClient).AccountID - if v, ok := d.GetOk("aws_account_id"); ok { + if v, ok := d.GetOk(names.AttrAWSAccountID); ok { awsAccountId = v.(string) } dataSetID := d.Get("data_set_id").(string) @@ -942,7 +942,7 @@ func resourceDataSetRead(ctx context.Context, d *schema.ResourceData, meta inter dataSet := output.DataSet d.Set(names.AttrARN, dataSet.Arn) - d.Set("aws_account_id", awsAccountId) + d.Set(names.AttrAWSAccountID, awsAccountId) d.Set("data_set_id", dataSet.DataSetId) d.Set(names.AttrName, dataSet.Name) d.Set("import_mode", dataSet.ImportMode) diff --git a/internal/service/quicksight/data_set_data_source.go b/internal/service/quicksight/data_set_data_source.go index cba2ee04657..7092687806c 100644 --- a/internal/service/quicksight/data_set_data_source.go +++ b/internal/service/quicksight/data_set_data_source.go @@ -28,7 +28,7 @@ func DataSourceDataSet() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "aws_account_id": { + names.AttrAWSAccountID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -620,7 +620,7 @@ func dataSourceDataSetRead(ctx context.Context, d *schema.ResourceData, meta int ignoreTagsConfig := meta.(*conns.AWSClient).IgnoreTagsConfig awsAccountId := meta.(*conns.AWSClient).AccountID - if v, ok := d.GetOk("aws_account_id"); ok { + if v, ok := d.GetOk(names.AttrAWSAccountID); ok { awsAccountId = v.(string) } dataSetId := d.Get("data_set_id").(string) @@ -640,7 +640,7 @@ func dataSourceDataSetRead(ctx context.Context, d *schema.ResourceData, meta int d.SetId(createDataSetID(awsAccountId, dataSetId)) d.Set(names.AttrARN, dataSet.Arn) - d.Set("aws_account_id", awsAccountId) + d.Set(names.AttrAWSAccountID, awsAccountId) d.Set("data_set_id", dataSet.DataSetId) d.Set(names.AttrName, dataSet.Name) d.Set("import_mode", dataSet.ImportMode) diff --git a/internal/service/quicksight/data_source.go b/internal/service/quicksight/data_source.go index f64c078a97e..9f65f427c76 100644 --- a/internal/service/quicksight/data_source.go +++ b/internal/service/quicksight/data_source.go @@ -41,7 +41,7 @@ func ResourceDataSource() *schema.Resource { Computed: true, }, - "aws_account_id": { + names.AttrAWSAccountID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -615,7 +615,7 @@ func resourceDataSourceCreate(ctx context.Context, d *schema.ResourceData, meta awsAccountId := meta.(*conns.AWSClient).AccountID id := d.Get("data_source_id").(string) - if v, ok := d.GetOk("aws_account_id"); ok { + if v, ok := d.GetOk(names.AttrAWSAccountID); ok { awsAccountId = v.(string) } @@ -690,7 +690,7 @@ func resourceDataSourceRead(ctx context.Context, d *schema.ResourceData, meta in dataSource := output.DataSource d.Set(names.AttrARN, dataSource.Arn) - d.Set("aws_account_id", awsAccountId) + d.Set(names.AttrAWSAccountID, awsAccountId) d.Set("data_source_id", dataSource.DataSourceId) d.Set(names.AttrName, dataSource.Name) diff --git a/internal/service/quicksight/folder.go b/internal/service/quicksight/folder.go index f57a095d444..d946aaaf6c7 100644 --- a/internal/service/quicksight/folder.go +++ b/internal/service/quicksight/folder.go @@ -52,7 +52,7 @@ func ResourceFolder() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "aws_account_id": { + names.AttrAWSAccountID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -140,7 +140,7 @@ func resourceFolderCreate(ctx context.Context, d *schema.ResourceData, meta inte conn := meta.(*conns.AWSClient).QuickSightConn(ctx) awsAccountId := meta.(*conns.AWSClient).AccountID - if v, ok := d.GetOk("aws_account_id"); ok { + if v, ok := d.GetOk(names.AttrAWSAccountID); ok { awsAccountId = v.(string) } @@ -199,7 +199,7 @@ func resourceFolderRead(ctx context.Context, d *schema.ResourceData, meta interf } d.Set(names.AttrARN, out.Arn) - d.Set("aws_account_id", awsAccountId) + d.Set(names.AttrAWSAccountID, awsAccountId) d.Set(names.AttrCreatedTime, out.CreatedTime.Format(time.RFC3339)) d.Set("folder_id", out.FolderId) d.Set("folder_type", out.FolderType) diff --git a/internal/service/quicksight/folder_membership.go b/internal/service/quicksight/folder_membership.go index cba375de027..86fc1377897 100644 --- a/internal/service/quicksight/folder_membership.go +++ b/internal/service/quicksight/folder_membership.go @@ -49,7 +49,7 @@ func (r *resourceFolderMembership) Metadata(_ context.Context, req resource.Meta func (r *resourceFolderMembership) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ - "aws_account_id": schema.StringAttribute{ + names.AttrAWSAccountID: schema.StringAttribute{ Optional: true, Computed: true, PlanModifiers: []planmodifier.String{ diff --git a/internal/service/quicksight/group.go b/internal/service/quicksight/group.go index 4c40113a756..4f07e7d8b7e 100644 --- a/internal/service/quicksight/group.go +++ b/internal/service/quicksight/group.go @@ -44,7 +44,7 @@ func ResourceGroup() *schema.Resource { Computed: true, }, - "aws_account_id": { + names.AttrAWSAccountID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -84,7 +84,7 @@ func resourceGroupCreate(ctx context.Context, d *schema.ResourceData, meta inter awsAccountID := meta.(*conns.AWSClient).AccountID namespace := d.Get(names.AttrNamespace).(string) - if v, ok := d.GetOk("aws_account_id"); ok { + if v, ok := d.GetOk(names.AttrAWSAccountID); ok { awsAccountID = v.(string) } @@ -134,7 +134,7 @@ func resourceGroupRead(ctx context.Context, d *schema.ResourceData, meta interfa } d.Set(names.AttrARN, resp.Group.Arn) - d.Set("aws_account_id", awsAccountID) + d.Set(names.AttrAWSAccountID, awsAccountID) d.Set(names.AttrGroupName, resp.Group.GroupName) d.Set(names.AttrDescription, resp.Group.Description) d.Set(names.AttrNamespace, namespace) diff --git a/internal/service/quicksight/group_data_source.go b/internal/service/quicksight/group_data_source.go index e4e4c31f6fb..aab4ab6ae56 100644 --- a/internal/service/quicksight/group_data_source.go +++ b/internal/service/quicksight/group_data_source.go @@ -30,7 +30,7 @@ func DataSourceGroup() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "aws_account_id": { + names.AttrAWSAccountID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -66,7 +66,7 @@ func dataSourceGroupRead(ctx context.Context, d *schema.ResourceData, meta inter conn := meta.(*conns.AWSClient).QuickSightConn(ctx) awsAccountID := meta.(*conns.AWSClient).AccountID - if v, ok := d.GetOk("aws_account_id"); ok { + if v, ok := d.GetOk(names.AttrAWSAccountID); ok { awsAccountID = v.(string) } groupName := d.Get(names.AttrGroupName).(string) @@ -88,7 +88,7 @@ func dataSourceGroupRead(ctx context.Context, d *schema.ResourceData, meta inter group := out.Group d.SetId(fmt.Sprintf("%s/%s/%s", awsAccountID, namespace, aws.StringValue(group.GroupName))) d.Set(names.AttrARN, group.Arn) - d.Set("aws_account_id", awsAccountID) + d.Set(names.AttrAWSAccountID, awsAccountID) d.Set(names.AttrDescription, group.Description) d.Set(names.AttrGroupName, group.GroupName) d.Set("principal_id", group.PrincipalId) diff --git a/internal/service/quicksight/group_membership.go b/internal/service/quicksight/group_membership.go index 36009ff9029..92fd3c1605c 100644 --- a/internal/service/quicksight/group_membership.go +++ b/internal/service/quicksight/group_membership.go @@ -37,7 +37,7 @@ func ResourceGroupMembership() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "aws_account_id": { + names.AttrAWSAccountID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -76,7 +76,7 @@ func resourceGroupMembershipCreate(ctx context.Context, d *schema.ResourceData, groupName := d.Get(names.AttrGroupName).(string) memberName := d.Get("member_name").(string) - if v, ok := d.GetOk("aws_account_id"); ok { + if v, ok := d.GetOk(names.AttrAWSAccountID); ok { awsAccountID = v.(string) } @@ -122,7 +122,7 @@ func resourceGroupMembershipRead(ctx context.Context, d *schema.ResourceData, me return nil } - d.Set("aws_account_id", awsAccountID) + d.Set(names.AttrAWSAccountID, awsAccountID) d.Set(names.AttrNamespace, namespace) d.Set("member_name", userName) d.Set(names.AttrGroupName, groupName) diff --git a/internal/service/quicksight/iam_policy_assignment.go b/internal/service/quicksight/iam_policy_assignment.go index 069c304b971..ee81fa2a8f5 100644 --- a/internal/service/quicksight/iam_policy_assignment.go +++ b/internal/service/quicksight/iam_policy_assignment.go @@ -71,7 +71,7 @@ func (r *resourceIAMPolicyAssignment) Schema(ctx context.Context, req resource.S stringvalidator.OneOf(quicksight.AssignmentStatus_Values()...), }, }, - "aws_account_id": schema.StringAttribute{ + names.AttrAWSAccountID: schema.StringAttribute{ Optional: true, Computed: true, PlanModifiers: []planmodifier.String{ diff --git a/internal/service/quicksight/ingestion.go b/internal/service/quicksight/ingestion.go index fa7b8dd9e63..bb90913c9c0 100644 --- a/internal/service/quicksight/ingestion.go +++ b/internal/service/quicksight/ingestion.go @@ -51,7 +51,7 @@ func (r *resourceIngestion) Schema(ctx context.Context, req resource.SchemaReque names.AttrARN: schema.StringAttribute{ Computed: true, }, - "aws_account_id": schema.StringAttribute{ + names.AttrAWSAccountID: schema.StringAttribute{ Optional: true, Computed: true, PlanModifiers: []planmodifier.String{ diff --git a/internal/service/quicksight/namespace.go b/internal/service/quicksight/namespace.go index 777329f8aef..959c129103c 100644 --- a/internal/service/quicksight/namespace.go +++ b/internal/service/quicksight/namespace.go @@ -57,7 +57,7 @@ func (r *resourceNamespace) Schema(ctx context.Context, req resource.SchemaReque resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ names.AttrARN: framework.ARNAttributeComputedOnly(), - "aws_account_id": schema.StringAttribute{ + names.AttrAWSAccountID: schema.StringAttribute{ Optional: true, Computed: true, PlanModifiers: []planmodifier.String{ diff --git a/internal/service/quicksight/refresh_schedule.go b/internal/service/quicksight/refresh_schedule.go index 5d51c8d1958..9e60e26d3af 100644 --- a/internal/service/quicksight/refresh_schedule.go +++ b/internal/service/quicksight/refresh_schedule.go @@ -60,7 +60,7 @@ func (r *resourceRefreshSchedule) Schema(ctx context.Context, req resource.Schem resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ names.AttrARN: framework.ARNAttributeComputedOnly(), - "aws_account_id": schema.StringAttribute{ + names.AttrAWSAccountID: schema.StringAttribute{ Optional: true, Computed: true, PlanModifiers: []planmodifier.String{ diff --git a/internal/service/quicksight/sweep.go b/internal/service/quicksight/sweep.go index 068fed7d541..aae599274be 100644 --- a/internal/service/quicksight/sweep.go +++ b/internal/service/quicksight/sweep.go @@ -430,7 +430,7 @@ func sweepVPCConnections(region string) error { vpcConnectionID := aws.StringValue(v.VPCConnectionId) sweepResources = append(sweepResources, framework.NewSweepResource(newResourceVPCConnection, client, framework.NewAttribute(names.AttrID, createVPCConnectionID(awsAccountId, vpcConnectionID)), - framework.NewAttribute("aws_account_id", awsAccountId), + framework.NewAttribute(names.AttrAWSAccountID, awsAccountId), framework.NewAttribute("vpc_connection_id", vpcConnectionID), )) } diff --git a/internal/service/quicksight/template.go b/internal/service/quicksight/template.go index de6a3ecbd75..3fe88da0eeb 100644 --- a/internal/service/quicksight/template.go +++ b/internal/service/quicksight/template.go @@ -51,7 +51,7 @@ func ResourceTemplate() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "aws_account_id": { + names.AttrAWSAccountID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -134,7 +134,7 @@ func resourceTemplateCreate(ctx context.Context, d *schema.ResourceData, meta in conn := meta.(*conns.AWSClient).QuickSightConn(ctx) awsAccountId := meta.(*conns.AWSClient).AccountID - if v, ok := d.GetOk("aws_account_id"); ok { + if v, ok := d.GetOk(names.AttrAWSAccountID); ok { awsAccountId = v.(string) } templateId := d.Get("template_id").(string) @@ -197,7 +197,7 @@ func resourceTemplateRead(ctx context.Context, d *schema.ResourceData, meta inte } d.Set(names.AttrARN, out.Arn) - d.Set("aws_account_id", awsAccountId) + d.Set(names.AttrAWSAccountID, awsAccountId) d.Set(names.AttrCreatedTime, out.CreatedTime.Format(time.RFC3339)) d.Set("last_updated_time", out.LastUpdatedTime.Format(time.RFC3339)) d.Set(names.AttrName, out.Name) diff --git a/internal/service/quicksight/template_alias.go b/internal/service/quicksight/template_alias.go index 9dc244a3654..fe7fb210152 100644 --- a/internal/service/quicksight/template_alias.go +++ b/internal/service/quicksight/template_alias.go @@ -53,7 +53,7 @@ func (r *resourceTemplateAlias) Schema(ctx context.Context, req resource.SchemaR }, }, names.AttrARN: framework.ARNAttributeComputedOnly(), - "aws_account_id": schema.StringAttribute{ + names.AttrAWSAccountID: schema.StringAttribute{ Optional: true, Computed: true, PlanModifiers: []planmodifier.String{ diff --git a/internal/service/quicksight/theme.go b/internal/service/quicksight/theme.go index f5eabac1e75..9f8f946880b 100644 --- a/internal/service/quicksight/theme.go +++ b/internal/service/quicksight/theme.go @@ -52,7 +52,7 @@ func ResourceTheme() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "aws_account_id": { + names.AttrAWSAccountID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -353,7 +353,7 @@ func resourceThemeCreate(ctx context.Context, d *schema.ResourceData, meta inter conn := meta.(*conns.AWSClient).QuickSightConn(ctx) awsAccountId := meta.(*conns.AWSClient).AccountID - if v, ok := d.GetOk("aws_account_id"); ok { + if v, ok := d.GetOk(names.AttrAWSAccountID); ok { awsAccountId = v.(string) } themeId := d.Get("theme_id").(string) @@ -413,7 +413,7 @@ func resourceThemeRead(ctx context.Context, d *schema.ResourceData, meta interfa } d.Set(names.AttrARN, out.Arn) - d.Set("aws_account_id", awsAccountId) + d.Set(names.AttrAWSAccountID, awsAccountId) d.Set("base_theme_id", out.Version.BaseThemeId) d.Set(names.AttrCreatedTime, out.CreatedTime.Format(time.RFC3339)) d.Set("last_updated_time", out.LastUpdatedTime.Format(time.RFC3339)) diff --git a/internal/service/quicksight/theme_data_source.go b/internal/service/quicksight/theme_data_source.go index 029c9b54140..36c673540c1 100644 --- a/internal/service/quicksight/theme_data_source.go +++ b/internal/service/quicksight/theme_data_source.go @@ -29,7 +29,7 @@ func DataSourceTheme() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "aws_account_id": { + names.AttrAWSAccountID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -284,7 +284,7 @@ func dataSourceThemeRead(ctx context.Context, d *schema.ResourceData, meta inter conn := meta.(*conns.AWSClient).QuickSightConn(ctx) awsAccountId := meta.(*conns.AWSClient).AccountID - if v, ok := d.GetOk("aws_account_id"); ok { + if v, ok := d.GetOk(names.AttrAWSAccountID); ok { awsAccountId = v.(string) } themeId := d.Get("theme_id").(string) @@ -299,7 +299,7 @@ func dataSourceThemeRead(ctx context.Context, d *schema.ResourceData, meta inter d.SetId(id) d.Set(names.AttrARN, out.Arn) - d.Set("aws_account_id", awsAccountId) + d.Set(names.AttrAWSAccountID, awsAccountId) d.Set("base_theme_id", out.Version.BaseThemeId) d.Set(names.AttrCreatedTime, out.CreatedTime.Format(time.RFC3339)) d.Set("last_updated_time", out.LastUpdatedTime.Format(time.RFC3339)) diff --git a/internal/service/quicksight/user.go b/internal/service/quicksight/user.go index 8d292b3a680..5149ff2901c 100644 --- a/internal/service/quicksight/user.go +++ b/internal/service/quicksight/user.go @@ -40,7 +40,7 @@ func ResourceUser() *schema.Resource { Computed: true, }, - "aws_account_id": { + names.AttrAWSAccountID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -115,7 +115,7 @@ func resourceUserCreate(ctx context.Context, d *schema.ResourceData, meta interf namespace := d.Get(names.AttrNamespace).(string) - if v, ok := d.GetOk("aws_account_id"); ok { + if v, ok := d.GetOk(names.AttrAWSAccountID); ok { awsAccountID = v.(string) } @@ -175,7 +175,7 @@ func resourceUserRead(ctx context.Context, d *schema.ResourceData, meta interfac } d.Set(names.AttrARN, resp.User.Arn) - d.Set("aws_account_id", awsAccountID) + d.Set(names.AttrAWSAccountID, awsAccountID) d.Set(names.AttrEmail, resp.User.Email) d.Set(names.AttrNamespace, namespace) d.Set("user_role", resp.User.Role) diff --git a/internal/service/quicksight/user_data_source.go b/internal/service/quicksight/user_data_source.go index 032d590f2a9..1ccd8fed544 100644 --- a/internal/service/quicksight/user_data_source.go +++ b/internal/service/quicksight/user_data_source.go @@ -34,7 +34,7 @@ func DataSourceUser() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "aws_account_id": { + names.AttrAWSAccountID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -78,7 +78,7 @@ func dataSourceUserRead(ctx context.Context, d *schema.ResourceData, meta interf conn := meta.(*conns.AWSClient).QuickSightConn(ctx) awsAccountID := meta.(*conns.AWSClient).AccountID - if v, ok := d.GetOk("aws_account_id"); ok { + if v, ok := d.GetOk(names.AttrAWSAccountID); ok { awsAccountID = v.(string) } namespace := d.Get(names.AttrNamespace).(string) @@ -99,7 +99,7 @@ func dataSourceUserRead(ctx context.Context, d *schema.ResourceData, meta interf d.SetId(fmt.Sprintf("%s/%s/%s", awsAccountID, namespace, aws.StringValue(out.User.UserName))) d.Set("active", out.User.Active) d.Set(names.AttrARN, out.User.Arn) - d.Set("aws_account_id", awsAccountID) + d.Set(names.AttrAWSAccountID, awsAccountID) d.Set(names.AttrEmail, out.User.Email) d.Set("identity_type", out.User.IdentityType) d.Set("principal_id", out.User.PrincipalId) diff --git a/internal/service/quicksight/vpc_connection.go b/internal/service/quicksight/vpc_connection.go index 5cc12584dd8..ac4f6d5e833 100644 --- a/internal/service/quicksight/vpc_connection.go +++ b/internal/service/quicksight/vpc_connection.go @@ -64,7 +64,7 @@ func (r *resourceVPCConnection) Schema(ctx context.Context, req resource.SchemaR resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ names.AttrARN: framework.ARNAttributeComputedOnly(), - "aws_account_id": schema.StringAttribute{ + names.AttrAWSAccountID: schema.StringAttribute{ Optional: true, Computed: true, PlanModifiers: []planmodifier.String{ diff --git a/internal/service/ram/resource_share_data_source.go b/internal/service/ram/resource_share_data_source.go index 3a6edaf684b..fdc3714a6e9 100644 --- a/internal/service/ram/resource_share_data_source.go +++ b/internal/service/ram/resource_share_data_source.go @@ -65,7 +65,7 @@ func dataSourceResourceShare() *schema.Resource { Type: schema.TypeString, }, }, - "resource_owner": { + names.AttrResourceOwner: { Type: schema.TypeString, Required: true, ValidateDiagFunc: enum.Validate[awstypes.ResourceOwner](), @@ -88,7 +88,7 @@ func dataSourceResourceShareRead(ctx context.Context, d *schema.ResourceData, me var diags diag.Diagnostics conn := meta.(*conns.AWSClient).RAMClient(ctx) - resourceOwner := d.Get("resource_owner").(string) + resourceOwner := d.Get(names.AttrResourceOwner).(string) inputG := &ram.GetResourceSharesInput{ ResourceOwner: awstypes.ResourceOwner(resourceOwner), } diff --git a/internal/service/rds/blue_green.go b/internal/service/rds/blue_green.go index da04628fc6e..e3aca1ff40c 100644 --- a/internal/service/rds/blue_green.go +++ b/internal/service/rds/blue_green.go @@ -136,8 +136,8 @@ func (h *instanceHandler) createBlueGreenInput(d *schema.ResourceData) *rds_sdkv if d.HasChange(names.AttrEngineVersion) { input.TargetEngineVersion = aws.String(d.Get(names.AttrEngineVersion).(string)) } - if d.HasChange("parameter_group_name") { - input.TargetDBParameterGroupName = aws.String(d.Get("parameter_group_name").(string)) + if d.HasChange(names.AttrParameterGroupName) { + input.TargetDBParameterGroupName = aws.String(d.Get(names.AttrParameterGroupName).(string)) } return input diff --git a/internal/service/rds/cluster.go b/internal/service/rds/cluster.go index ba1901a0c27..980c3b83321 100644 --- a/internal/service/rds/cluster.go +++ b/internal/service/rds/cluster.go @@ -210,7 +210,7 @@ func ResourceCluster() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -525,7 +525,7 @@ func ResourceCluster() *schema.Resource { Optional: true, ForceNew: true, }, - "storage_encrypted": { + names.AttrStorageEncrypted: { Type: schema.TypeBool, Optional: true, Computed: true, @@ -550,7 +550,7 @@ func ResourceCluster() *schema.Resource { verify.SetTagsDiff, customdiff.ForceNewIf(names.AttrStorageType, func(_ context.Context, d *schema.ResourceDiff, meta interface{}) bool { // Aurora supports mutation of the storage_type parameter, other engines do not - return !strings.HasPrefix(d.Get("engine").(string), "aurora") + return !strings.HasPrefix(d.Get(names.AttrEngine).(string), "aurora") }), func(_ context.Context, diff *schema.ResourceDiff, _ any) error { if diff.Id() == "" { @@ -596,7 +596,7 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, meta int CopyTagsToSnapshot: aws.Bool(d.Get("copy_tags_to_snapshot").(bool)), DBClusterIdentifier: aws.String(identifier), DeletionProtection: aws.Bool(d.Get("deletion_protection").(bool)), - Engine: aws.String(d.Get("engine").(string)), + Engine: aws.String(d.Get(names.AttrEngine).(string)), EngineMode: aws.String(d.Get("engine_mode").(string)), SnapshotIdentifier: aws.String(v.(string)), Tags: getTagsIn(ctx), @@ -719,7 +719,7 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, meta int CopyTagsToSnapshot: aws.Bool(d.Get("copy_tags_to_snapshot").(bool)), DBClusterIdentifier: aws.String(identifier), DeletionProtection: aws.Bool(d.Get("deletion_protection").(bool)), - Engine: aws.String(d.Get("engine").(string)), + Engine: aws.String(d.Get(names.AttrEngine).(string)), MasterUsername: aws.String(d.Get("master_username").(string)), S3BucketName: aws.String(tfMap[names.AttrBucketName].(string)), S3IngestionRoleArn: aws.String(tfMap["ingestion_role"].(string)), @@ -805,7 +805,7 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, meta int input.PreferredMaintenanceWindow = aws.String(v.(string)) } - if v, ok := d.GetOkExists("storage_encrypted"); ok { + if v, ok := d.GetOkExists(names.AttrStorageEncrypted); ok { input.StorageEncrypted = aws.Bool(v.(bool)) } @@ -962,7 +962,7 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, meta int CopyTagsToSnapshot: aws.Bool(d.Get("copy_tags_to_snapshot").(bool)), DBClusterIdentifier: aws.String(identifier), DeletionProtection: aws.Bool(d.Get("deletion_protection").(bool)), - Engine: aws.String(d.Get("engine").(string)), + Engine: aws.String(d.Get(names.AttrEngine).(string)), EngineMode: aws.String(d.Get("engine_mode").(string)), Tags: getTagsIn(ctx), } @@ -1099,7 +1099,7 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, meta int input.SourceRegion = aws.String(v.(string)) } - if v, ok := d.GetOkExists("storage_encrypted"); ok { + if v, ok := d.GetOkExists(names.AttrStorageEncrypted); ok { input.StorageEncrypted = aws.Bool(v.(bool)) } @@ -1204,7 +1204,7 @@ func resourceClusterRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set("enabled_cloudwatch_logs_exports", aws.StringValueSlice(dbc.EnabledCloudwatchLogsExports)) d.Set("enable_http_endpoint", dbc.HttpEndpointEnabled) d.Set(names.AttrEndpoint, dbc.Endpoint) - d.Set("engine", dbc.Engine) + d.Set(names.AttrEngine, dbc.Engine) d.Set("engine_mode", dbc.EngineMode) clusterSetResourceDataEngineVersionFromCluster(d, dbc) d.Set(names.AttrHostedZoneID, dbc.HostedZoneId) @@ -1256,7 +1256,7 @@ func resourceClusterRead(ctx context.Context, d *schema.ResourceData, meta inter } else { d.Set("serverlessv2_scaling_configuration", nil) } - d.Set("storage_encrypted", dbc.StorageEncrypted) + d.Set(names.AttrStorageEncrypted, dbc.StorageEncrypted) d.Set(names.AttrStorageType, dbc.StorageType) var securityGroupIDs []string for _, v := range dbc.VpcSecurityGroups { diff --git a/internal/service/rds/cluster_data_source.go b/internal/service/rds/cluster_data_source.go index b725126d8ee..546396ef0d8 100644 --- a/internal/service/rds/cluster_data_source.go +++ b/internal/service/rds/cluster_data_source.go @@ -76,7 +76,7 @@ func DataSourceCluster() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Computed: true, }, @@ -157,7 +157,7 @@ func DataSourceCluster() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "storage_encrypted": { + names.AttrStorageEncrypted: { Type: schema.TypeBool, Computed: true, }, @@ -209,7 +209,7 @@ func dataSourceClusterRead(ctx context.Context, d *schema.ResourceData, meta int d.Set("db_system_id", dbc.DBSystemId) d.Set("enabled_cloudwatch_logs_exports", aws.StringValueSlice(dbc.EnabledCloudwatchLogsExports)) d.Set(names.AttrEndpoint, dbc.Endpoint) - d.Set("engine", dbc.Engine) + d.Set(names.AttrEngine, dbc.Engine) d.Set("engine_mode", dbc.EngineMode) d.Set(names.AttrEngineVersion, dbc.EngineVersion) d.Set(names.AttrHostedZoneID, dbc.HostedZoneId) @@ -232,7 +232,7 @@ func dataSourceClusterRead(ctx context.Context, d *schema.ResourceData, meta int d.Set(names.AttrPreferredMaintenanceWindow, dbc.PreferredMaintenanceWindow) d.Set("reader_endpoint", dbc.ReaderEndpoint) d.Set("replication_source_identifier", dbc.ReplicationSourceIdentifier) - d.Set("storage_encrypted", dbc.StorageEncrypted) + d.Set(names.AttrStorageEncrypted, dbc.StorageEncrypted) var securityGroupIDs []string for _, v := range dbc.VpcSecurityGroups { securityGroupIDs = append(securityGroupIDs, aws.StringValue(v.VpcSecurityGroupId)) diff --git a/internal/service/rds/cluster_data_source_test.go b/internal/service/rds/cluster_data_source_test.go index 93c012d6d2a..280fe09e294 100644 --- a/internal/service/rds/cluster_data_source_test.go +++ b/internal/service/rds/cluster_data_source_test.go @@ -34,7 +34,7 @@ func TestAccRDSClusterDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "db_cluster_parameter_group_name", resourceName, "db_cluster_parameter_group_name"), resource.TestCheckResourceAttrPair(dataSourceName, "db_subnet_group_name", resourceName, "db_subnet_group_name"), resource.TestCheckResourceAttrPair(dataSourceName, "db_system_id", resourceName, "db_system_id"), - resource.TestCheckResourceAttrPair(dataSourceName, "engine", resourceName, "engine"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEngine, resourceName, names.AttrEngine), resource.TestCheckResourceAttrPair(dataSourceName, "engine_mode", resourceName, "engine_mode"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEngineVersion, resourceName, names.AttrEngineVersion), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrHostedZoneID, resourceName, names.AttrHostedZoneID), @@ -68,7 +68,7 @@ func TestAccRDSClusterDataSource_ManagedMasterPassword_managed(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, names.AttrDatabaseName, resourceName, names.AttrDatabaseName), resource.TestCheckResourceAttrPair(dataSourceName, "db_cluster_parameter_group_name", resourceName, "db_cluster_parameter_group_name"), resource.TestCheckResourceAttrPair(dataSourceName, "db_subnet_group_name", resourceName, "db_subnet_group_name"), - resource.TestCheckResourceAttrPair(dataSourceName, "engine", resourceName, "engine"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEngine, resourceName, names.AttrEngine), resource.TestCheckResourceAttrPair(dataSourceName, "engine_mode", resourceName, "engine_mode"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEngineVersion, resourceName, names.AttrEngineVersion), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrHostedZoneID, resourceName, names.AttrHostedZoneID), diff --git a/internal/service/rds/cluster_instance.go b/internal/service/rds/cluster_instance.go index 34d858b151b..d379d2ef534 100644 --- a/internal/service/rds/cluster_instance.go +++ b/internal/service/rds/cluster_instance.go @@ -108,7 +108,7 @@ func ResourceClusterInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -221,7 +221,7 @@ func ResourceClusterInstance() *schema.Resource { Optional: true, Computed: true, }, - "storage_encrypted": { + names.AttrStorageEncrypted: { Type: schema.TypeBool, Computed: true, }, @@ -253,7 +253,7 @@ func resourceClusterInstanceCreate(ctx context.Context, d *schema.ResourceData, DBClusterIdentifier: aws.String(clusterID), DBInstanceClass: aws.String(d.Get("instance_class").(string)), DBInstanceIdentifier: aws.String(identifier), - Engine: aws.String(d.Get("engine").(string)), + Engine: aws.String(d.Get(names.AttrEngine).(string)), PromotionTier: aws.Int64(int64(d.Get("promotion_tier").(int))), PubliclyAccessible: aws.Bool(d.Get(names.AttrPubliclyAccessible).(bool)), Tags: getTagsIn(ctx), @@ -408,7 +408,7 @@ func resourceClusterInstanceRead(ctx context.Context, d *schema.ResourceData, me d.Set("db_subnet_group_name", db.DBSubnetGroup.DBSubnetGroupName) } d.Set("dbi_resource_id", db.DbiResourceId) - d.Set("engine", db.Engine) + d.Set(names.AttrEngine, db.Engine) d.Set(names.AttrIdentifier, db.DBInstanceIdentifier) d.Set("identifier_prefix", create.NamePrefixFromName(aws.StringValue(db.DBInstanceIdentifier))) d.Set("instance_class", db.DBInstanceClass) @@ -423,7 +423,7 @@ func resourceClusterInstanceRead(ctx context.Context, d *schema.ResourceData, me d.Set(names.AttrPreferredMaintenanceWindow, db.PreferredMaintenanceWindow) d.Set("promotion_tier", db.PromotionTier) d.Set(names.AttrPubliclyAccessible, db.PubliclyAccessible) - d.Set("storage_encrypted", db.StorageEncrypted) + d.Set(names.AttrStorageEncrypted, db.StorageEncrypted) clusterSetResourceDataEngineVersionFromClusterInstance(d, db) @@ -524,8 +524,8 @@ func resourceClusterInstanceDelete(ctx context.Context, d *schema.ResourceData, } // Automatically set skip_final_snapshot = true for RDS Custom instances - if strings.HasPrefix(d.Get("engine").(string), InstanceEngineCustomPrefix) { - log.Printf("[DEBUG] RDS Custom engine detected (%s) applying SkipFinalSnapshot: %s", d.Get("engine").(string), "true") + if strings.HasPrefix(d.Get(names.AttrEngine).(string), InstanceEngineCustomPrefix) { + log.Printf("[DEBUG] RDS Custom engine detected (%s) applying SkipFinalSnapshot: %s", d.Get(names.AttrEngine).(string), "true") input.SkipFinalSnapshot = aws.Bool(true) } diff --git a/internal/service/rds/cluster_instance_test.go b/internal/service/rds/cluster_instance_test.go index bb361aed16f..29f24ac7d63 100644 --- a/internal/service/rds/cluster_instance_test.go +++ b/internal/service/rds/cluster_instance_test.go @@ -49,7 +49,7 @@ func TestAccRDSClusterInstance_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "copy_tags_to_snapshot", acctest.CtFalse), resource.TestCheckResourceAttr(resourceName, "custom_iam_instance_profile", ""), resource.TestCheckResourceAttrSet(resourceName, "dbi_resource_id"), - resource.TestCheckResourceAttr(resourceName, "engine", "aurora-mysql"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "aurora-mysql"), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), resource.TestCheckResourceAttr(resourceName, names.AttrIdentifier, rName), resource.TestCheckResourceAttr(resourceName, "identifier_prefix", ""), diff --git a/internal/service/rds/cluster_migrate.go b/internal/service/rds/cluster_migrate.go index 5b16329fc2c..6073d2f146f 100644 --- a/internal/service/rds/cluster_migrate.go +++ b/internal/service/rds/cluster_migrate.go @@ -134,7 +134,7 @@ func resourceClusterResourceV0() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -384,7 +384,7 @@ func resourceClusterResourceV0() *schema.Resource { Optional: true, ForceNew: true, }, - "storage_encrypted": { + names.AttrStorageEncrypted: { Type: schema.TypeBool, Optional: true, Computed: true, diff --git a/internal/service/rds/cluster_snapshot.go b/internal/service/rds/cluster_snapshot.go index 0f2380477a7..b659ab6e759 100644 --- a/internal/service/rds/cluster_snapshot.go +++ b/internal/service/rds/cluster_snapshot.go @@ -75,7 +75,7 @@ func ResourceClusterSnapshot() *schema.Resource { validation.StringDoesNotMatch(regexache.MustCompile(`-$`), "cannot end with a hyphen"), ), }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Computed: true, }, @@ -107,7 +107,7 @@ func ResourceClusterSnapshot() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "storage_encrypted": { + names.AttrStorageEncrypted: { Type: schema.TypeBool, Computed: true, }, @@ -173,14 +173,14 @@ func resourceClusterSnapshotRead(ctx context.Context, d *schema.ResourceData, me d.Set("db_cluster_snapshot_arn", snapshot.DBClusterSnapshotArn) d.Set("db_cluster_snapshot_identifier", snapshot.DBClusterSnapshotIdentifier) d.Set(names.AttrEngineVersion, snapshot.EngineVersion) - d.Set("engine", snapshot.Engine) + d.Set(names.AttrEngine, snapshot.Engine) d.Set(names.AttrKMSKeyID, snapshot.KmsKeyId) d.Set("license_model", snapshot.LicenseModel) d.Set(names.AttrPort, snapshot.Port) d.Set("snapshot_type", snapshot.SnapshotType) d.Set("source_db_cluster_snapshot_arn", snapshot.SourceDBClusterSnapshotArn) d.Set(names.AttrStatus, snapshot.Status) - d.Set("storage_encrypted", snapshot.StorageEncrypted) + d.Set(names.AttrStorageEncrypted, snapshot.StorageEncrypted) d.Set(names.AttrVPCID, snapshot.VpcId) setTagsOut(ctx, snapshot.TagList) diff --git a/internal/service/rds/cluster_snapshot_data_source.go b/internal/service/rds/cluster_snapshot_data_source.go index 7f298007b0f..12c6f578eec 100644 --- a/internal/service/rds/cluster_snapshot_data_source.go +++ b/internal/service/rds/cluster_snapshot_data_source.go @@ -47,7 +47,7 @@ func DataSourceClusterSnapshot() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Computed: true, }, @@ -98,7 +98,7 @@ func DataSourceClusterSnapshot() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "storage_encrypted": { + names.AttrStorageEncrypted: { Type: schema.TypeBool, Computed: true, }, @@ -166,7 +166,7 @@ func dataSourceClusterSnapshotRead(ctx context.Context, d *schema.ResourceData, d.Set("db_cluster_identifier", snapshot.DBClusterIdentifier) d.Set("db_cluster_snapshot_arn", snapshot.DBClusterSnapshotArn) d.Set("db_cluster_snapshot_identifier", snapshot.DBClusterSnapshotIdentifier) - d.Set("engine", snapshot.Engine) + d.Set(names.AttrEngine, snapshot.Engine) d.Set(names.AttrEngineVersion, snapshot.EngineVersion) d.Set(names.AttrKMSKeyID, snapshot.KmsKeyId) d.Set("license_model", snapshot.LicenseModel) @@ -177,7 +177,7 @@ func dataSourceClusterSnapshotRead(ctx context.Context, d *schema.ResourceData, d.Set("snapshot_type", snapshot.SnapshotType) d.Set("source_db_cluster_snapshot_arn", snapshot.SourceDBClusterSnapshotArn) d.Set(names.AttrStatus, snapshot.Status) - d.Set("storage_encrypted", snapshot.StorageEncrypted) + d.Set(names.AttrStorageEncrypted, snapshot.StorageEncrypted) d.Set(names.AttrVPCID, snapshot.VpcId) setTagsOut(ctx, snapshot.TagList) diff --git a/internal/service/rds/cluster_snapshot_data_source_test.go b/internal/service/rds/cluster_snapshot_data_source_test.go index 6243f351865..f0a9d8a1f32 100644 --- a/internal/service/rds/cluster_snapshot_data_source_test.go +++ b/internal/service/rds/cluster_snapshot_data_source_test.go @@ -32,7 +32,7 @@ func TestAccRDSClusterSnapshotDataSource_dbClusterSnapshotIdentifier(t *testing. resource.TestCheckResourceAttrPair(dataSourceName, "db_cluster_identifier", resourceName, "db_cluster_identifier"), resource.TestCheckResourceAttrPair(dataSourceName, "db_cluster_snapshot_arn", resourceName, "db_cluster_snapshot_arn"), resource.TestCheckResourceAttrPair(dataSourceName, "db_cluster_snapshot_identifier", resourceName, "db_cluster_snapshot_identifier"), - resource.TestCheckResourceAttrPair(dataSourceName, "engine", resourceName, "engine"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEngine, resourceName, names.AttrEngine), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEngineVersion, resourceName, names.AttrEngineVersion), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrKMSKeyID, resourceName, names.AttrKMSKeyID), resource.TestCheckResourceAttrPair(dataSourceName, "license_model", resourceName, "license_model"), @@ -41,7 +41,7 @@ func TestAccRDSClusterSnapshotDataSource_dbClusterSnapshotIdentifier(t *testing. resource.TestCheckResourceAttrPair(dataSourceName, "snapshot_type", resourceName, "snapshot_type"), resource.TestCheckResourceAttrPair(dataSourceName, "source_db_cluster_snapshot_arn", resourceName, "source_db_cluster_snapshot_arn"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrStatus, resourceName, names.AttrStatus), - resource.TestCheckResourceAttrPair(dataSourceName, "storage_encrypted", resourceName, "storage_encrypted"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrStorageEncrypted, resourceName, names.AttrStorageEncrypted), resource.TestCheckResourceAttrPair(dataSourceName, acctest.CtTagsPercent, resourceName, acctest.CtTagsPercent), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrVPCID, resourceName, names.AttrVPCID), ), @@ -69,7 +69,7 @@ func TestAccRDSClusterSnapshotDataSource_dbClusterIdentifier(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "db_cluster_identifier", resourceName, "db_cluster_identifier"), resource.TestCheckResourceAttrPair(dataSourceName, "db_cluster_snapshot_arn", resourceName, "db_cluster_snapshot_arn"), resource.TestCheckResourceAttrPair(dataSourceName, "db_cluster_snapshot_identifier", resourceName, "db_cluster_snapshot_identifier"), - resource.TestCheckResourceAttrPair(dataSourceName, "engine", resourceName, "engine"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEngine, resourceName, names.AttrEngine), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEngineVersion, resourceName, names.AttrEngineVersion), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrKMSKeyID, resourceName, names.AttrKMSKeyID), resource.TestCheckResourceAttrPair(dataSourceName, "license_model", resourceName, "license_model"), @@ -78,7 +78,7 @@ func TestAccRDSClusterSnapshotDataSource_dbClusterIdentifier(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "snapshot_type", resourceName, "snapshot_type"), resource.TestCheckResourceAttrPair(dataSourceName, "source_db_cluster_snapshot_arn", resourceName, "source_db_cluster_snapshot_arn"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrStatus, resourceName, names.AttrStatus), - resource.TestCheckResourceAttrPair(dataSourceName, "storage_encrypted", resourceName, "storage_encrypted"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrStorageEncrypted, resourceName, names.AttrStorageEncrypted), resource.TestCheckResourceAttrPair(dataSourceName, acctest.CtTagsPercent, resourceName, acctest.CtTagsPercent), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrVPCID, resourceName, names.AttrVPCID), ), diff --git a/internal/service/rds/cluster_snapshot_test.go b/internal/service/rds/cluster_snapshot_test.go index 05f4ab3ce76..e4fecd736d9 100644 --- a/internal/service/rds/cluster_snapshot_test.go +++ b/internal/service/rds/cluster_snapshot_test.go @@ -39,7 +39,7 @@ func TestAccRDSClusterSnapshot_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "allocated_storage"), resource.TestCheckResourceAttrSet(resourceName, "availability_zones.#"), acctest.MatchResourceAttrRegionalARN(resourceName, "db_cluster_snapshot_arn", "rds", regexache.MustCompile(fmt.Sprintf("cluster-snapshot:%s$", rName))), - resource.TestCheckResourceAttrSet(resourceName, "engine"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEngine), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyID, ""), resource.TestCheckResourceAttrSet(resourceName, "license_model"), @@ -47,7 +47,7 @@ func TestAccRDSClusterSnapshot_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "snapshot_type", "manual"), resource.TestCheckResourceAttr(resourceName, "source_db_cluster_snapshot_arn", ""), resource.TestCheckResourceAttr(resourceName, names.AttrStatus, "available"), - resource.TestCheckResourceAttr(resourceName, "storage_encrypted", acctest.CtFalse), + resource.TestCheckResourceAttr(resourceName, names.AttrStorageEncrypted, acctest.CtFalse), resource.TestMatchResourceAttr(resourceName, names.AttrVPCID, regexache.MustCompile(`^vpc-.+`)), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct0), ), diff --git a/internal/service/rds/cluster_test.go b/internal/service/rds/cluster_test.go index a52e4498ec0..8f450657eb0 100644 --- a/internal/service/rds/cluster_test.go +++ b/internal/service/rds/cluster_test.go @@ -87,14 +87,14 @@ func TestAccRDSCluster_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrDomain, ""), resource.TestCheckResourceAttr(resourceName, "domain_iam_role_name", ""), resource.TestCheckResourceAttr(resourceName, "enabled_cloudwatch_logs_exports.#", acctest.Ct0), - resource.TestCheckResourceAttr(resourceName, "engine", tfrds.ClusterEngineAuroraMySQL), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, tfrds.ClusterEngineAuroraMySQL), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), resource.TestCheckResourceAttr(resourceName, "global_cluster_identifier", ""), resource.TestCheckResourceAttrSet(resourceName, names.AttrHostedZoneID), resource.TestCheckResourceAttr(resourceName, "network_type", "IPV4"), resource.TestCheckResourceAttrSet(resourceName, "reader_endpoint"), resource.TestCheckResourceAttr(resourceName, "scaling_configuration.#", acctest.Ct0), - resource.TestCheckResourceAttr(resourceName, "storage_encrypted", acctest.CtFalse), + resource.TestCheckResourceAttr(resourceName, names.AttrStorageEncrypted, acctest.CtFalse), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct0), ), }, @@ -240,7 +240,7 @@ func TestAccRDSCluster_allowMajorVersionUpgrade(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &dbCluster1), resource.TestCheckResourceAttr(resourceName, "allow_major_version_upgrade", acctest.CtTrue), - resource.TestCheckResourceAttr(resourceName, "engine", tfrds.ClusterEngineAuroraPostgreSQL), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, tfrds.ClusterEngineAuroraPostgreSQL), resource.TestCheckResourceAttrPair(resourceName, names.AttrEngineVersion, dataSourceName, "version_actual"), ), }, @@ -250,7 +250,7 @@ func TestAccRDSCluster_allowMajorVersionUpgrade(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &dbCluster2), resource.TestCheckResourceAttr(resourceName, "allow_major_version_upgrade", acctest.CtTrue), - resource.TestCheckResourceAttr(resourceName, "engine", tfrds.ClusterEngineAuroraPostgreSQL), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, tfrds.ClusterEngineAuroraPostgreSQL), resource.TestCheckResourceAttrPair(resourceName, names.AttrEngineVersion, dataSourceNameUpgrade, "version_actual"), ), }, @@ -281,7 +281,7 @@ func TestAccRDSCluster_allowMajorVersionUpgradeNoApplyImmediately(t *testing.T) Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &dbCluster1), resource.TestCheckResourceAttr(resourceName, "allow_major_version_upgrade", acctest.CtTrue), - resource.TestCheckResourceAttr(resourceName, "engine", tfrds.ClusterEngineAuroraPostgreSQL), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, tfrds.ClusterEngineAuroraPostgreSQL), resource.TestCheckResourceAttrPair(resourceName, names.AttrEngineVersion, dataSourceName, "version_actual"), ), }, @@ -291,7 +291,7 @@ func TestAccRDSCluster_allowMajorVersionUpgradeNoApplyImmediately(t *testing.T) Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &dbCluster2), resource.TestCheckResourceAttr(resourceName, "allow_major_version_upgrade", acctest.CtTrue), - resource.TestCheckResourceAttr(resourceName, "engine", tfrds.ClusterEngineAuroraPostgreSQL), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, tfrds.ClusterEngineAuroraPostgreSQL), resource.TestCheckResourceAttrPair(resourceName, names.AttrEngineVersion, dataSourceNameUpgrade, "version_actual"), ), }, @@ -320,7 +320,7 @@ func TestAccRDSCluster_allowMajorVersionUpgradeWithCustomParametersApplyImm(t *t Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &dbCluster1), resource.TestCheckResourceAttr(resourceName, "allow_major_version_upgrade", acctest.CtTrue), - resource.TestCheckResourceAttr(resourceName, "engine", tfrds.ClusterEngineAuroraPostgreSQL), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, tfrds.ClusterEngineAuroraPostgreSQL), resource.TestCheckResourceAttrPair(resourceName, names.AttrEngineVersion, "data.aws_rds_engine_version.test", "version_actual"), ), }, @@ -329,7 +329,7 @@ func TestAccRDSCluster_allowMajorVersionUpgradeWithCustomParametersApplyImm(t *t Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &dbCluster2), resource.TestCheckResourceAttr(resourceName, "allow_major_version_upgrade", acctest.CtTrue), - resource.TestCheckResourceAttr(resourceName, "engine", tfrds.ClusterEngineAuroraPostgreSQL), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, tfrds.ClusterEngineAuroraPostgreSQL), resource.TestCheckResourceAttrPair(resourceName, names.AttrEngineVersion, "data.aws_rds_engine_version.upgrade", "version_actual"), ), }, @@ -358,7 +358,7 @@ func TestAccRDSCluster_allowMajorVersionUpgradeWithCustomParameters(t *testing.T Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &dbCluster1), resource.TestCheckResourceAttr(resourceName, "allow_major_version_upgrade", acctest.CtTrue), - resource.TestCheckResourceAttr(resourceName, "engine", tfrds.ClusterEngineAuroraPostgreSQL), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, tfrds.ClusterEngineAuroraPostgreSQL), resource.TestCheckResourceAttrPair(resourceName, names.AttrEngineVersion, "data.aws_rds_engine_version.test", "version_actual"), ), }, @@ -368,7 +368,7 @@ func TestAccRDSCluster_allowMajorVersionUpgradeWithCustomParameters(t *testing.T Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &dbCluster2), resource.TestCheckResourceAttr(resourceName, "allow_major_version_upgrade", acctest.CtTrue), - resource.TestCheckResourceAttr(resourceName, "engine", tfrds.ClusterEngineAuroraPostgreSQL), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, tfrds.ClusterEngineAuroraPostgreSQL), resource.TestCheckResourceAttrPair(resourceName, names.AttrEngineVersion, "data.aws_rds_engine_version.upgrade", "version_actual"), ), }, @@ -397,7 +397,7 @@ func TestAccRDSCluster_onlyMajorVersion(t *testing.T) { Config: testAccClusterConfig_majorVersionOnly(rName, tfrds.ClusterEngineAuroraPostgreSQL, false), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &dbCluster1), - resource.TestCheckResourceAttr(resourceName, "engine", tfrds.ClusterEngineAuroraPostgreSQL), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, tfrds.ClusterEngineAuroraPostgreSQL), resource.TestCheckResourceAttrPair(resourceName, names.AttrEngineVersion, dataSourceName, "version_actual"), ), }, @@ -443,7 +443,7 @@ func TestAccRDSCluster_minorVersion(t *testing.T) { Config: testAccClusterConfig_minorVersion(rName, tfrds.ClusterEngineAuroraPostgreSQL, false), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &dbCluster1), - resource.TestCheckResourceAttr(resourceName, "engine", tfrds.ClusterEngineAuroraPostgreSQL), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, tfrds.ClusterEngineAuroraPostgreSQL), resource.TestCheckResourceAttrPair(resourceName, names.AttrEngineVersion, "data.aws_rds_engine_version.test", "version_actual"), ), }, @@ -451,7 +451,7 @@ func TestAccRDSCluster_minorVersion(t *testing.T) { Config: testAccClusterConfig_minorVersion(rName, tfrds.ClusterEngineAuroraPostgreSQL, true), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &dbCluster2), - resource.TestCheckResourceAttr(resourceName, "engine", tfrds.ClusterEngineAuroraPostgreSQL), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, tfrds.ClusterEngineAuroraPostgreSQL), resource.TestCheckResourceAttrPair(resourceName, names.AttrEngineVersion, "data.aws_rds_engine_version.upgrade", "version_actual"), ), }, @@ -830,7 +830,7 @@ func TestAccRDSCluster_pointInTimeRestore(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, sourceResourceName, &sourceDBCluster), testAccCheckClusterExists(ctx, resourceName, &dbCluster), - resource.TestCheckResourceAttrPair(resourceName, "engine", sourceResourceName, "engine"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrEngine, sourceResourceName, names.AttrEngine), ), }, }, @@ -1126,7 +1126,7 @@ func TestAccRDSCluster_encrypted(t *testing.T) { Config: testAccClusterConfig_encrypted(sdkacctest.RandInt()), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "storage_encrypted", acctest.CtTrue), + resource.TestCheckResourceAttr(resourceName, names.AttrStorageEncrypted, acctest.CtTrue), ), }, }, @@ -1360,7 +1360,7 @@ func TestAccRDSCluster_engineVersion(t *testing.T) { Config: testAccClusterConfig_engineVersion(rName, false), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &dbCluster), - resource.TestCheckResourceAttr(resourceName, "engine", tfrds.ClusterEngineAuroraPostgreSQL), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, tfrds.ClusterEngineAuroraPostgreSQL), resource.TestCheckResourceAttrPair(resourceName, names.AttrEngineVersion, dataSourceName, names.AttrVersion), ), }, @@ -1394,7 +1394,7 @@ func TestAccRDSCluster_engineVersionWithPrimaryInstance(t *testing.T) { Config: testAccClusterConfig_engineVersionPrimaryInstance(rName, false), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &dbCluster), - resource.TestCheckResourceAttrPair(resourceName, "engine", dataSourceName, "engine"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrEngine, dataSourceName, names.AttrEngine), resource.TestCheckResourceAttrPair(resourceName, names.AttrEngineVersion, dataSourceName, names.AttrVersion), ), }, @@ -1402,7 +1402,7 @@ func TestAccRDSCluster_engineVersionWithPrimaryInstance(t *testing.T) { Config: testAccClusterConfig_engineVersionPrimaryInstance(rName, true), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &dbCluster), - resource.TestCheckResourceAttrPair(resourceName, "engine", dataSourceNameUpgrade, "engine"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrEngine, dataSourceNameUpgrade, names.AttrEngine), resource.TestCheckResourceAttrPair(resourceName, names.AttrEngineVersion, dataSourceNameUpgrade, names.AttrVersion), ), }, @@ -1680,7 +1680,7 @@ func TestAccRDSCluster_ManagedMasterPassword_managed(t *testing.T) { testAccCheckClusterExists(ctx, resourceName, &dbCluster), acctest.CheckResourceAttrRegionalARN(resourceName, names.AttrARN, "rds", fmt.Sprintf("cluster:%s", rName)), resource.TestCheckResourceAttrSet(resourceName, "cluster_resource_id"), - resource.TestCheckResourceAttr(resourceName, "engine", tfrds.ClusterEngineAuroraMySQL), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, tfrds.ClusterEngineAuroraMySQL), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), resource.TestCheckResourceAttr(resourceName, "manage_master_user_password", acctest.CtTrue), resource.TestCheckResourceAttr(resourceName, "master_user_secret.#", acctest.Ct1), @@ -1712,7 +1712,7 @@ func TestAccRDSCluster_ManagedMasterPassword_managedSpecificKMSKey(t *testing.T) testAccCheckClusterExists(ctx, resourceName, &dbCluster), acctest.CheckResourceAttrRegionalARN(resourceName, names.AttrARN, "rds", fmt.Sprintf("cluster:%s", rName)), resource.TestCheckResourceAttrSet(resourceName, "cluster_resource_id"), - resource.TestCheckResourceAttr(resourceName, "engine", tfrds.ClusterEngineAuroraMySQL), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, tfrds.ClusterEngineAuroraMySQL), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), resource.TestCheckResourceAttr(resourceName, "manage_master_user_password", acctest.CtTrue), resource.TestCheckResourceAttr(resourceName, "master_user_secret.#", acctest.Ct1), @@ -2425,7 +2425,7 @@ func TestAccRDSCluster_SnapshotIdentifier_encryptedRestore(t *testing.T) { testAccCheckClusterSnapshotExists(ctx, snapshotResourceName, &dbClusterSnapshot), testAccCheckClusterExists(ctx, resourceName, &dbCluster), resource.TestCheckResourceAttrPair(resourceName, names.AttrKMSKeyID, kmsKeyResourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "storage_encrypted", acctest.CtTrue), + resource.TestCheckResourceAttr(resourceName, names.AttrStorageEncrypted, acctest.CtTrue), ), }, }, diff --git a/internal/service/rds/custom_db_engine_version.go b/internal/service/rds/custom_db_engine_version.go index 39e62238fb0..6e651289d31 100644 --- a/internal/service/rds/custom_db_engine_version.go +++ b/internal/service/rds/custom_db_engine_version.go @@ -78,7 +78,7 @@ func ResourceCustomDBEngineVersion() *schema.Resource { Optional: true, ValidateFunc: validation.StringLenBetween(1, 1000), }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -169,7 +169,7 @@ func resourceCustomDBEngineVersionCreate(ctx context.Context, d *schema.Resource conn := meta.(*conns.AWSClient).RDSConn(ctx) input := rds.CreateCustomDBEngineVersionInput{ - Engine: aws.String(d.Get("engine").(string)), + Engine: aws.String(d.Get(names.AttrEngine).(string)), EngineVersion: aws.String(d.Get(names.AttrEngineVersion).(string)), Tags: getTagsIn(ctx), } @@ -247,7 +247,7 @@ func resourceCustomDBEngineVersionRead(ctx context.Context, d *schema.ResourceDa d.Set("database_installation_files_s3_prefix", out.DatabaseInstallationFilesS3Prefix) d.Set("db_parameter_group_family", out.DBParameterGroupFamily) d.Set(names.AttrDescription, out.DBEngineVersionDescription) - d.Set("engine", out.Engine) + d.Set(names.AttrEngine, out.Engine) d.Set(names.AttrEngineVersion, out.EngineVersion) d.Set("image_id", out.Image.ImageId) d.Set(names.AttrKMSKeyID, out.KMSKeyId) diff --git a/internal/service/rds/engine_version_data_source.go b/internal/service/rds/engine_version_data_source.go index d825e137144..a51d2117fd1 100644 --- a/internal/service/rds/engine_version_data_source.go +++ b/internal/service/rds/engine_version_data_source.go @@ -35,7 +35,7 @@ func DataSourceEngineVersion() *schema.Resource { Optional: true, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Required: true, }, @@ -200,7 +200,7 @@ func dataSourceEngineVersionRead(ctx context.Context, d *schema.ResourceData, me ListSupportedTimezones: aws.Bool(true), } - if v, ok := d.GetOk("engine"); ok { + if v, ok := d.GetOk(names.AttrEngine); ok { input.Engine = aws.String(v.(string)) } @@ -415,7 +415,7 @@ func dataSourceEngineVersionRead(ctx context.Context, d *schema.ResourceData, me d.Set("default_character_set", found.DefaultCharacterSet.CharacterSetName) } - d.Set("engine", found.Engine) + d.Set(names.AttrEngine, found.Engine) d.Set("engine_description", found.DBEngineDescription) d.Set("exportable_log_types", found.ExportableLogTypes) d.Set("parameter_group_family", found.DBParameterGroupFamily) diff --git a/internal/service/rds/engine_version_data_source_test.go b/internal/service/rds/engine_version_data_source_test.go index 1fc385f4889..489824a8963 100644 --- a/internal/service/rds/engine_version_data_source_test.go +++ b/internal/service/rds/engine_version_data_source_test.go @@ -35,7 +35,7 @@ func TestAccRDSEngineVersionDataSource_basic(t *testing.T) { { Config: testAccEngineVersionDataSourceConfig_basic(engine, version, paramGroup), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(dataSourceName, "engine", engine), + resource.TestCheckResourceAttr(dataSourceName, names.AttrEngine, engine), resource.TestCheckResourceAttr(dataSourceName, names.AttrVersion, version), resource.TestCheckResourceAttr(dataSourceName, "version_actual", version), resource.TestCheckResourceAttr(dataSourceName, "parameter_group_family", paramGroup), diff --git a/internal/service/rds/global_cluster.go b/internal/service/rds/global_cluster.go index 30d6f177788..accb5f32028 100644 --- a/internal/service/rds/global_cluster.go +++ b/internal/service/rds/global_cluster.go @@ -58,7 +58,7 @@ func ResourceGlobalCluster() *schema.Resource { Optional: true, Default: false, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Optional: true, Computed: true, @@ -110,10 +110,10 @@ func ResourceGlobalCluster() *schema.Resource { Optional: true, Computed: true, ForceNew: true, - ConflictsWith: []string{"engine"}, + ConflictsWith: []string{names.AttrEngine}, RequiredWith: []string{names.AttrForceDestroy}, }, - "storage_encrypted": { + names.AttrStorageEncrypted: { Type: schema.TypeBool, Optional: true, Computed: true, @@ -140,7 +140,7 @@ func resourceGlobalClusterCreate(ctx context.Context, d *schema.ResourceData, me input.DeletionProtection = aws.Bool(v.(bool)) } - if v, ok := d.GetOk("engine"); ok { + if v, ok := d.GetOk(names.AttrEngine); ok { input.Engine = aws.String(v.(string)) } @@ -152,7 +152,7 @@ func resourceGlobalClusterCreate(ctx context.Context, d *schema.ResourceData, me input.SourceDBClusterIdentifier = aws.String(v.(string)) } - if v, ok := d.GetOk("storage_encrypted"); ok { + if v, ok := d.GetOk(names.AttrStorageEncrypted); ok { input.StorageEncrypted = aws.Bool(v.(bool)) } @@ -197,13 +197,13 @@ func resourceGlobalClusterRead(ctx context.Context, d *schema.ResourceData, meta d.Set(names.AttrARN, globalCluster.GlobalClusterArn) d.Set(names.AttrDatabaseName, globalCluster.DatabaseName) d.Set("deletion_protection", globalCluster.DeletionProtection) - d.Set("engine", globalCluster.Engine) + d.Set(names.AttrEngine, globalCluster.Engine) d.Set("global_cluster_identifier", globalCluster.GlobalClusterIdentifier) if err := d.Set("global_cluster_members", flattenGlobalClusterMembers(globalCluster.GlobalClusterMembers)); err != nil { return sdkdiag.AppendErrorf(diags, "setting global_cluster_members: %s", err) } d.Set("global_cluster_resource_id", globalCluster.GlobalClusterResourceId) - d.Set("storage_encrypted", globalCluster.StorageEncrypted) + d.Set(names.AttrStorageEncrypted, globalCluster.StorageEncrypted) oldEngineVersion := d.Get(names.AttrEngineVersion).(string) newEngineVersion := aws.StringValue(globalCluster.EngineVersion) diff --git a/internal/service/rds/global_cluster_test.go b/internal/service/rds/global_cluster_test.go index d67a8a444c2..6d77c27c0e8 100644 --- a/internal/service/rds/global_cluster_test.go +++ b/internal/service/rds/global_cluster_test.go @@ -118,11 +118,11 @@ func TestAccRDSGlobalCluster_basic(t *testing.T) { acctest.CheckResourceAttrGlobalARN(resourceName, names.AttrARN, "rds", fmt.Sprintf("global-cluster:%s", rName)), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, ""), resource.TestCheckResourceAttr(resourceName, "deletion_protection", acctest.CtFalse), - resource.TestCheckResourceAttr(resourceName, "engine", "aurora-postgresql"), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "aurora-postgresql"), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), resource.TestCheckResourceAttr(resourceName, "global_cluster_identifier", rName), resource.TestMatchResourceAttr(resourceName, "global_cluster_resource_id", regexache.MustCompile(`cluster-.+`)), - resource.TestCheckResourceAttr(resourceName, "storage_encrypted", acctest.CtFalse), + resource.TestCheckResourceAttr(resourceName, names.AttrStorageEncrypted, acctest.CtFalse), ), }, { @@ -543,7 +543,7 @@ func TestAccRDSGlobalCluster_storageEncrypted(t *testing.T) { Config: testAccGlobalClusterConfig_storageEncrypted(rName, true), Check: resource.ComposeTestCheckFunc( testAccCheckGlobalClusterExists(ctx, resourceName, &globalCluster1), - resource.TestCheckResourceAttr(resourceName, "storage_encrypted", acctest.CtTrue), + resource.TestCheckResourceAttr(resourceName, names.AttrStorageEncrypted, acctest.CtTrue), ), }, { @@ -556,7 +556,7 @@ func TestAccRDSGlobalCluster_storageEncrypted(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckGlobalClusterExists(ctx, resourceName, &globalCluster2), testAccCheckGlobalClusterRecreated(&globalCluster1, &globalCluster2), - resource.TestCheckResourceAttr(resourceName, "storage_encrypted", acctest.CtFalse), + resource.TestCheckResourceAttr(resourceName, names.AttrStorageEncrypted, acctest.CtFalse), ), }, }, diff --git a/internal/service/rds/instance.go b/internal/service/rds/instance.go index 4474b4863d2..2efe3588ee8 100644 --- a/internal/service/rds/instance.go +++ b/internal/service/rds/instance.go @@ -296,7 +296,7 @@ func ResourceInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Optional: true, Computed: true, @@ -480,7 +480,7 @@ func ResourceInstance() *schema.Resource { Optional: true, Computed: true, }, - "parameter_group_name": { + names.AttrParameterGroupName: { Type: schema.TypeString, Optional: true, Computed: true, @@ -631,7 +631,7 @@ func ResourceInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "storage_encrypted": { + names.AttrStorageEncrypted: { Type: schema.TypeBool, Optional: true, ForceNew: true, @@ -679,7 +679,7 @@ func ResourceInstance() *schema.Resource { return nil } - engine := d.Get("engine").(string) + engine := d.Get(names.AttrEngine).(string) if !slices.Contains(dbInstanceValidBlueGreenEngines(), engine) { return fmt.Errorf(`"blue_green_update.enabled" cannot be set when "engine" is %q.`, engine) } @@ -817,7 +817,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in input.OptionGroupName = aws.String(v.(string)) } - if v, ok := d.GetOk("parameter_group_name"); ok { + if v, ok := d.GetOk(names.AttrParameterGroupName); ok { crossRegion := false if arn.IsARN(sourceDBInstanceID) { sourceARN, err := arn.Parse(sourceDBInstanceID) @@ -927,7 +927,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in } } - if v, ok := d.GetOk("parameter_group_name"); ok { + if v, ok := d.GetOk(names.AttrParameterGroupName); ok { if len(output.DBInstance.DBParameterGroups) > 0 { if current, desired := aws.StringValue(output.DBInstance.DBParameterGroups[0].DBParameterGroupName), v.(string); current != desired { modifyDbInstanceInput.DBParameterGroupName = aws.String(desired) @@ -945,7 +945,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in if _, ok := d.GetOk("allocated_storage"); !ok { diags = sdkdiag.AppendErrorf(diags, `"allocated_storage": required field is not set`) } - if _, ok := d.GetOk("engine"); !ok { + if _, ok := d.GetOk(names.AttrEngine); !ok { diags = sdkdiag.AppendErrorf(diags, `"engine": required field is not set`) } if _, ok := d.GetOk(names.AttrUsername); !ok { @@ -965,7 +965,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in DBInstanceIdentifier: aws.String(identifier), DBName: aws.String(d.Get("db_name").(string)), DeletionProtection: aws.Bool(d.Get("deletion_protection").(bool)), - Engine: aws.String(d.Get("engine").(string)), + Engine: aws.String(d.Get(names.AttrEngine).(string)), EngineVersion: aws.String(d.Get(names.AttrEngineVersion).(string)), MasterUsername: aws.String(d.Get(names.AttrUsername).(string)), PubliclyAccessible: aws.Bool(d.Get(names.AttrPubliclyAccessible).(bool)), @@ -974,7 +974,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in S3Prefix: aws.String(tfMap[names.AttrBucketPrefix].(string)), SourceEngine: aws.String(tfMap["source_engine"].(string)), SourceEngineVersion: aws.String(tfMap["source_engine_version"].(string)), - StorageEncrypted: aws.Bool(d.Get("storage_encrypted").(bool)), + StorageEncrypted: aws.Bool(d.Get(names.AttrStorageEncrypted).(bool)), Tags: getTagsIn(ctx), } @@ -1042,7 +1042,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in input.OptionGroupName = aws.String(v.(string)) } - if v, ok := d.GetOk("parameter_group_name"); ok { + if v, ok := d.GetOk(names.AttrParameterGroupName); ok { input.DBParameterGroupName = aws.String(v.(string)) } @@ -1120,7 +1120,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in Tags: getTagsIn(ctx), } - engine := strings.ToLower(d.Get("engine").(string)) + engine := strings.ToLower(d.Get(names.AttrEngine).(string)) if v, ok := d.GetOk("db_name"); ok { // "Note: This parameter [DBName] doesn't apply to the MySQL, PostgreSQL, or MariaDB engines." // https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_RestoreDBInstanceFromDBSnapshot.html @@ -1280,7 +1280,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in input.OptionGroupName = aws.String(v.(string)) } - if v, ok := d.GetOk("parameter_group_name"); ok { + if v, ok := d.GetOk(names.AttrParameterGroupName); ok { input.DBParameterGroupName = aws.String(v.(string)) } @@ -1450,7 +1450,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in input.EnableCloudwatchLogsExports = flex.ExpandStringSet(v.(*schema.Set)) } - if v, ok := d.GetOk("engine"); ok { + if v, ok := d.GetOk(names.AttrEngine); ok { input.Engine = aws.String(v.(string)) } @@ -1498,7 +1498,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in input.OptionGroupName = aws.String(v.(string)) } - if v, ok := d.GetOk("parameter_group_name"); ok { + if v, ok := d.GetOk(names.AttrParameterGroupName); ok { input.DBParameterGroupName = aws.String(v.(string)) } @@ -1551,7 +1551,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in if _, ok := d.GetOk("allocated_storage"); !ok { diags = sdkdiag.AppendErrorf(diags, `"allocated_storage": required field is not set`) } - if _, ok := d.GetOk("engine"); !ok { + if _, ok := d.GetOk(names.AttrEngine); !ok { diags = sdkdiag.AppendErrorf(diags, `"engine": required field is not set`) } if _, ok := d.GetOk(names.AttrUsername); !ok { @@ -1570,11 +1570,11 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in DBInstanceIdentifier: aws.String(identifier), DBName: aws.String(d.Get("db_name").(string)), DeletionProtection: aws.Bool(d.Get("deletion_protection").(bool)), - Engine: aws.String(d.Get("engine").(string)), + Engine: aws.String(d.Get(names.AttrEngine).(string)), EngineVersion: aws.String(d.Get(names.AttrEngineVersion).(string)), MasterUsername: aws.String(d.Get(names.AttrUsername).(string)), PubliclyAccessible: aws.Bool(d.Get(names.AttrPubliclyAccessible).(bool)), - StorageEncrypted: aws.Bool(d.Get("storage_encrypted").(bool)), + StorageEncrypted: aws.Bool(d.Get(names.AttrStorageEncrypted).(bool)), Tags: getTagsIn(ctx), } @@ -1698,7 +1698,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in input.MasterUserPassword = aws.String(v.(string)) } - if v, ok := d.GetOk("parameter_group_name"); ok { + if v, ok := d.GetOk(names.AttrParameterGroupName); ok { input.DBParameterGroupName = aws.String(v.(string)) } @@ -1868,7 +1868,7 @@ func resourceInstanceRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set("domain_ou", nil) } d.Set("enabled_cloudwatch_logs_exports", aws.StringValueSlice(v.EnabledCloudwatchLogsExports)) - d.Set("engine", v.Engine) + d.Set(names.AttrEngine, v.Engine) d.Set("iam_database_authentication_enabled", v.IAMDatabaseAuthenticationEnabled) d.Set(names.AttrIdentifier, v.DBInstanceIdentifier) d.Set("identifier_prefix", create.NamePrefixFromName(aws.StringValue(v.DBInstanceIdentifier))) @@ -1911,7 +1911,7 @@ func resourceInstanceRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set("option_group_name", v.OptionGroupMemberships[0].OptionGroupName) } if len(v.DBParameterGroups) > 0 && v.DBParameterGroups[0] != nil { - d.Set("parameter_group_name", v.DBParameterGroups[0].DBParameterGroupName) + d.Set(names.AttrParameterGroupName, v.DBParameterGroups[0].DBParameterGroupName) } d.Set("performance_insights_enabled", v.PerformanceInsightsEnabled) d.Set("performance_insights_kms_key_id", v.PerformanceInsightsKMSKeyId) @@ -1923,7 +1923,7 @@ func resourceInstanceRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set("replicate_source_db", v.ReadReplicaSourceDBInstanceIdentifier) d.Set(names.AttrResourceID, v.DbiResourceId) d.Set(names.AttrStatus, v.DBInstanceStatus) - d.Set("storage_encrypted", v.StorageEncrypted) + d.Set(names.AttrStorageEncrypted, v.StorageEncrypted) d.Set("storage_throughput", v.StorageThroughput) d.Set(names.AttrStorageType, v.StorageType) d.Set("timezone", v.Timezone) @@ -2173,8 +2173,8 @@ func resourceInstanceUpdate(ctx context.Context, d *schema.ResourceData, meta in // for the source } - if d.HasChange("parameter_group_name") { - input.DBParameterGroupName = aws.String(d.Get("parameter_group_name").(string)) + if d.HasChange(names.AttrParameterGroupName) { + input.DBParameterGroupName = aws.String(d.Get(names.AttrParameterGroupName).(string)) } err := dbInstanceModify(ctx, conn, d.Id(), input, deadline.Remaining()) @@ -2545,7 +2545,7 @@ func isStorageTypeGP3BelowAllocatedStorageThreshold(d *schema.ResourceData) bool return false } - switch allocatedStorage, engine := d.Get("allocated_storage").(int), d.Get("engine").(string); engine { + switch allocatedStorage, engine := d.Get("allocated_storage").(int), d.Get(names.AttrEngine).(string); engine { case InstanceEngineDB2Advanced, InstanceEngineDB2Standard: return allocatedStorage < 100 case InstanceEngineMariaDB, InstanceEngineMySQL, InstanceEnginePostgres: diff --git a/internal/service/rds/instance_data_source.go b/internal/service/rds/instance_data_source.go index af1c51b9bd1..027c4e5ac87 100644 --- a/internal/service/rds/instance_data_source.go +++ b/internal/service/rds/instance_data_source.go @@ -92,7 +92,7 @@ func DataSourceInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Computed: true, }, @@ -189,7 +189,7 @@ func DataSourceInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "storage_encrypted": { + names.AttrStorageEncrypted: { Type: schema.TypeBool, Computed: true, }, @@ -273,7 +273,7 @@ func dataSourceInstanceRead(ctx context.Context, d *schema.ResourceData, meta in d.Set("db_subnet_group", "") } d.Set("enabled_cloudwatch_logs_exports", aws.StringValueSlice(instance.EnabledCloudwatchLogsExports)) - d.Set("engine", instance.Engine) + d.Set(names.AttrEngine, instance.Engine) d.Set(names.AttrEngineVersion, instance.EngineVersion) d.Set(names.AttrIOPS, instance.Iops) d.Set(names.AttrKMSKeyID, instance.KmsKeyId) @@ -298,7 +298,7 @@ func dataSourceInstanceRead(ctx context.Context, d *schema.ResourceData, meta in d.Set(names.AttrPubliclyAccessible, instance.PubliclyAccessible) d.Set("replicate_source_db", instance.ReadReplicaSourceDBInstanceIdentifier) d.Set(names.AttrResourceID, instance.DbiResourceId) - d.Set("storage_encrypted", instance.StorageEncrypted) + d.Set(names.AttrStorageEncrypted, instance.StorageEncrypted) d.Set("storage_throughput", instance.StorageThroughput) d.Set(names.AttrStorageType, instance.StorageType) d.Set("timezone", instance.Timezone) diff --git a/internal/service/rds/instance_data_source_test.go b/internal/service/rds/instance_data_source_test.go index acfa0d51ccb..0701a1fa58c 100644 --- a/internal/service/rds/instance_data_source_test.go +++ b/internal/service/rds/instance_data_source_test.go @@ -40,7 +40,7 @@ func TestAccRDSInstanceDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "db_subnet_group", resourceName, "db_subnet_group_name"), resource.TestCheckResourceAttrPair(dataSourceName, "enabled_cloudwatch_logs_exports.#", resourceName, "enabled_cloudwatch_logs_exports.#"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEndpoint, resourceName, names.AttrEndpoint), - resource.TestCheckResourceAttrPair(dataSourceName, "engine", resourceName, "engine"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEngine, resourceName, names.AttrEngine), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrHostedZoneID, resourceName, names.AttrHostedZoneID), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrIOPS, resourceName, names.AttrIOPS), resource.TestCheckResourceAttrPair(dataSourceName, "master_username", resourceName, names.AttrUsername), @@ -84,7 +84,7 @@ func TestAccRDSInstanceDataSource_ManagedMasterPassword_managed(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "db_name", resourceName, "db_name"), resource.TestCheckResourceAttrPair(dataSourceName, "db_subnet_group", resourceName, "db_subnet_group_name"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEndpoint, resourceName, names.AttrEndpoint), - resource.TestCheckResourceAttrPair(dataSourceName, "engine", resourceName, "engine"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEngine, resourceName, names.AttrEngine), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrHostedZoneID, resourceName, names.AttrHostedZoneID), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrIOPS, resourceName, names.AttrIOPS), resource.TestCheckResourceAttrPair(dataSourceName, "master_username", resourceName, names.AttrUsername), @@ -131,7 +131,7 @@ func TestAccRDSInstanceDataSource_tags(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "db_subnet_group", resourceName, "db_subnet_group_name"), resource.TestCheckResourceAttrPair(dataSourceName, "enabled_cloudwatch_logs_exports.#", resourceName, "enabled_cloudwatch_logs_exports.#"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEndpoint, resourceName, names.AttrEndpoint), - resource.TestCheckResourceAttrPair(dataSourceName, "engine", resourceName, "engine"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEngine, resourceName, names.AttrEngine), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrHostedZoneID, resourceName, names.AttrHostedZoneID), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrIOPS, resourceName, names.AttrIOPS), resource.TestCheckResourceAttrPair(dataSourceName, "master_username", resourceName, names.AttrUsername), diff --git a/internal/service/rds/instance_migrate.go b/internal/service/rds/instance_migrate.go index 05a2215271e..7a670168a5e 100644 --- a/internal/service/rds/instance_migrate.go +++ b/internal/service/rds/instance_migrate.go @@ -51,7 +51,7 @@ func resourceInstanceResourceV0() *schema.Resource { Optional: true, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Optional: true, Computed: true, @@ -77,7 +77,7 @@ func resourceInstanceResourceV0() *schema.Resource { ForceNew: true, }, - "storage_encrypted": { + names.AttrStorageEncrypted: { Type: schema.TypeBool, Optional: true, ForceNew: true, @@ -250,7 +250,7 @@ func resourceInstanceResourceV0() *schema.Resource { Computed: true, }, - "parameter_group_name": { + names.AttrParameterGroupName: { Type: schema.TypeString, Optional: true, Computed: true, @@ -555,7 +555,7 @@ func resourceInstanceResourceV1() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Optional: true, Computed: true, @@ -739,7 +739,7 @@ func resourceInstanceResourceV1() *schema.Resource { Optional: true, Computed: true, }, - "parameter_group_name": { + names.AttrParameterGroupName: { Type: schema.TypeString, Optional: true, Computed: true, @@ -886,7 +886,7 @@ func resourceInstanceResourceV1() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "storage_encrypted": { + names.AttrStorageEncrypted: { Type: schema.TypeBool, Optional: true, ForceNew: true, diff --git a/internal/service/rds/instance_migrate_test.go b/internal/service/rds/instance_migrate_test.go index ad5088f67a2..f1b39692573 100644 --- a/internal/service/rds/instance_migrate_test.go +++ b/internal/service/rds/instance_migrate_test.go @@ -30,7 +30,7 @@ func TestInstanceStateUpgradeV0(t *testing.T) { Description: "adds delete_automated_backups", InputState: map[string]interface{}{ "allocated_storage": 10, - "engine": "mariadb", + names.AttrEngine: "mariadb", names.AttrIdentifier: "my-test-instance", "instance_class": "db.t2.micro", names.AttrPassword: "avoid-plaintext-passwords", @@ -40,7 +40,7 @@ func TestInstanceStateUpgradeV0(t *testing.T) { ExpectedState: map[string]interface{}{ "allocated_storage": 10, "delete_automated_backups": true, - "engine": "mariadb", + names.AttrEngine: "mariadb", names.AttrIdentifier: "my-test-instance", "instance_class": "db.t2.micro", names.AttrPassword: "avoid-plaintext-passwords", @@ -85,7 +85,7 @@ func TestInstanceStateUpgradeV1(t *testing.T) { Description: "change id to resource id", InputState: map[string]interface{}{ "allocated_storage": 10, - "engine": "mariadb", + names.AttrEngine: "mariadb", names.AttrID: "my-test-instance", names.AttrIdentifier: "my-test-instance", "instance_class": "db.t2.micro", @@ -96,7 +96,7 @@ func TestInstanceStateUpgradeV1(t *testing.T) { }, ExpectedState: map[string]interface{}{ "allocated_storage": 10, - "engine": "mariadb", + names.AttrEngine: "mariadb", names.AttrID: "db-cnuap2ilnbmok4eunzklfvwjca", names.AttrIdentifier: "my-test-instance", "instance_class": "db.t2.micro", diff --git a/internal/service/rds/instance_test.go b/internal/service/rds/instance_test.go index e2e3081c384..b84646523bc 100644 --- a/internal/service/rds/instance_test.go +++ b/internal/service/rds/instance_test.go @@ -69,7 +69,7 @@ func TestAccRDSInstance_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "deletion_protection", acctest.CtFalse), resource.TestCheckResourceAttr(resourceName, "enabled_cloudwatch_logs_exports.#", acctest.Ct0), resource.TestCheckResourceAttrSet(resourceName, names.AttrEndpoint), - resource.TestCheckResourceAttr(resourceName, "engine", tfrds.InstanceEngineMySQL), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, tfrds.InstanceEngineMySQL), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), resource.TestCheckResourceAttrSet(resourceName, names.AttrHostedZoneID), resource.TestCheckResourceAttr(resourceName, "iam_database_authentication_enabled", acctest.CtFalse), @@ -83,13 +83,13 @@ func TestAccRDSInstance_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "maintenance_window"), resource.TestCheckResourceAttr(resourceName, "max_allocated_storage", acctest.Ct0), resource.TestMatchResourceAttr(resourceName, "option_group_name", regexache.MustCompile(`^default:mysql-\d`)), - resource.TestMatchResourceAttr(resourceName, "parameter_group_name", regexache.MustCompile(`^default\.mysql\d`)), + resource.TestMatchResourceAttr(resourceName, names.AttrParameterGroupName, regexache.MustCompile(`^default\.mysql\d`)), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "3306"), resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, acctest.CtFalse), resource.TestCheckResourceAttr(resourceName, "replicas.#", acctest.Ct0), resource.TestCheckResourceAttrSet(resourceName, names.AttrResourceID), resource.TestCheckResourceAttr(resourceName, names.AttrStatus, "available"), - resource.TestCheckResourceAttr(resourceName, "storage_encrypted", acctest.CtFalse), + resource.TestCheckResourceAttr(resourceName, names.AttrStorageEncrypted, acctest.CtFalse), resource.TestCheckResourceAttr(resourceName, "storage_throughput", acctest.Ct0), resource.TestCheckResourceAttr(resourceName, names.AttrStorageType, "gp2"), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct0), @@ -290,7 +290,7 @@ func TestAccRDSInstance_Versions_onlyMajor(t *testing.T) { Config: testAccInstanceConfig_majorVersionOnly(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "engine", tfrds.InstanceEngineMySQL), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, tfrds.InstanceEngineMySQL), resource.TestCheckResourceAttr(resourceName, names.AttrEngineVersion, "8.0"), ), }, @@ -1842,8 +1842,8 @@ func TestAccRDSInstance_ReplicateSourceDB_parameterGroupNameSameSetOnBoth(t *tes testAccCheckInstanceExists(ctx, sourceResourceName, &sourceDbInstance), testAccCheckInstanceExists(ctx, resourceName, &dbInstance), testAccCheckInstanceReplicaAttributes(&sourceDbInstance, &dbInstance), - resource.TestCheckResourceAttr(resourceName, "parameter_group_name", rName), - resource.TestCheckResourceAttrPair(resourceName, "parameter_group_name", sourceResourceName, "parameter_group_name"), + resource.TestCheckResourceAttr(resourceName, names.AttrParameterGroupName, rName), + resource.TestCheckResourceAttrPair(resourceName, names.AttrParameterGroupName, sourceResourceName, names.AttrParameterGroupName), testAccCheckInstanceParameterApplyStatusInSync(&dbInstance), testAccCheckInstanceParameterApplyStatusInSync(&sourceDbInstance), ), @@ -1874,10 +1874,10 @@ func TestAccRDSInstance_ReplicateSourceDB_parameterGroupNameDifferentSetOnBoth(t Config: testAccInstanceConfig_ReplicateSourceDB_ParameterGroupName_differentSetOnBoth(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExists(ctx, sourceResourceName, &sourceDbInstance), - resource.TestCheckResourceAttr(sourceResourceName, "parameter_group_name", fmt.Sprintf("%s-source", rName)), + resource.TestCheckResourceAttr(sourceResourceName, names.AttrParameterGroupName, fmt.Sprintf("%s-source", rName)), testAccCheckInstanceExists(ctx, resourceName, &dbInstance), testAccCheckInstanceReplicaAttributes(&sourceDbInstance, &dbInstance), - resource.TestCheckResourceAttr(resourceName, "parameter_group_name", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrParameterGroupName, rName), testAccCheckInstanceParameterApplyStatusInSync(&dbInstance), testAccCheckInstanceParameterApplyStatusInSync(&sourceDbInstance), ), @@ -1910,8 +1910,8 @@ func TestAccRDSInstance_ReplicateSourceDB_parameterGroupNameReplicaCopiesValue(t testAccCheckInstanceExists(ctx, sourceResourceName, &sourceDbInstance), testAccCheckInstanceExists(ctx, resourceName, &dbInstance), testAccCheckInstanceReplicaAttributes(&sourceDbInstance, &dbInstance), - resource.TestCheckResourceAttr(resourceName, "parameter_group_name", rName), - resource.TestCheckResourceAttrPair(resourceName, "parameter_group_name", sourceResourceName, "parameter_group_name"), + resource.TestCheckResourceAttr(resourceName, names.AttrParameterGroupName, rName), + resource.TestCheckResourceAttrPair(resourceName, names.AttrParameterGroupName, sourceResourceName, names.AttrParameterGroupName), testAccCheckInstanceParameterApplyStatusInSync(&dbInstance), ), }, @@ -1943,7 +1943,7 @@ func TestAccRDSInstance_ReplicateSourceDB_parameterGroupNameSetOnReplica(t *test testAccCheckInstanceExists(ctx, sourceResourceName, &sourceDbInstance), testAccCheckInstanceExists(ctx, resourceName, &dbInstance), testAccCheckInstanceReplicaAttributes(&sourceDbInstance, &dbInstance), - resource.TestCheckResourceAttr(resourceName, "parameter_group_name", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrParameterGroupName, rName), testAccCheckInstanceParameterApplyStatusInSync(&dbInstance), ), }, @@ -2206,7 +2206,7 @@ func TestAccRDSInstance_ReplicateSourceDB_parameterGroupTwoStep(t *testing.T) { Config: testAccInstanceConfig_ReplicateSourceDB_ParameterGroupTwoStep_setup(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExists(ctx, sourceResourceName, &sourceDbInstance), - resource.TestCheckResourceAttr(sourceResourceName, "parameter_group_name", "default.oracle-ee-19"), + resource.TestCheckResourceAttr(sourceResourceName, names.AttrParameterGroupName, "default.oracle-ee-19"), testAccCheckInstanceParameterApplyStatusInSync(&sourceDbInstance), ), }, @@ -2214,10 +2214,10 @@ func TestAccRDSInstance_ReplicateSourceDB_parameterGroupTwoStep(t *testing.T) { Config: testAccInstanceConfig_ReplicateSourceDB_parameterGroupTwoStep(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExists(ctx, sourceResourceName, &sourceDbInstance), - resource.TestCheckResourceAttr(sourceResourceName, "parameter_group_name", "default.oracle-ee-19"), + resource.TestCheckResourceAttr(sourceResourceName, names.AttrParameterGroupName, "default.oracle-ee-19"), testAccCheckInstanceExists(ctx, resourceName, &dbInstance), resource.TestCheckResourceAttr(resourceName, "replica_mode", "open-read-only"), - resource.TestCheckResourceAttrPair(resourceName, "parameter_group_name", parameterGroupResourceName, names.AttrName), + resource.TestCheckResourceAttrPair(resourceName, names.AttrParameterGroupName, parameterGroupResourceName, names.AttrName), testAccCheckInstanceParameterApplyStatusInSync(&dbInstance), testAccCheckInstanceParameterApplyStatusInSync(&sourceDbInstance), ), @@ -2249,10 +2249,10 @@ func TestAccRDSInstance_ReplicateSourceDB_CrossRegion_parameterGroupNameEquivale Config: testAccInstanceConfig_ReplicateSourceDB_CrossRegion_ParameterGroupName_equivalent(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExistsWithProvider(ctx, sourceResourceName, &sourceDbInstance, acctest.RegionProviderFunc(acctest.AlternateRegion(), &providers)), - resource.TestCheckResourceAttr(sourceResourceName, "parameter_group_name", fmt.Sprintf("%s-source", rName)), + resource.TestCheckResourceAttr(sourceResourceName, names.AttrParameterGroupName, fmt.Sprintf("%s-source", rName)), testAccCheckInstanceExistsWithProvider(ctx, resourceName, &dbInstance, acctest.RegionProviderFunc(acctest.Region(), &providers)), resource.TestCheckResourceAttrPair(resourceName, "replicate_source_db", sourceResourceName, names.AttrARN), - resource.TestCheckResourceAttrPair(resourceName, "parameter_group_name", "aws_db_parameter_group.test", names.AttrName), + resource.TestCheckResourceAttrPair(resourceName, names.AttrParameterGroupName, "aws_db_parameter_group.test", names.AttrName), testAccCheckInstanceParameterApplyStatusInSync(&dbInstance), testAccCheckInstanceParameterApplyStatusInSync(&sourceDbInstance), ), @@ -2380,13 +2380,13 @@ func TestAccRDSInstance_SnapshotIdentifier_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "dedicated_log_volume", acctest.CtFalse), resource.TestCheckResourceAttrPair(resourceName, "instance_class", sourceDbResourceName, "instance_class"), resource.TestCheckResourceAttrPair(resourceName, "allocated_storage", sourceDbResourceName, "allocated_storage"), - resource.TestCheckResourceAttrPair(resourceName, "engine", sourceDbResourceName, "engine"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrEngine, sourceDbResourceName, names.AttrEngine), resource.TestCheckResourceAttrPair(resourceName, names.AttrEngineVersion, sourceDbResourceName, names.AttrEngineVersion), resource.TestCheckResourceAttrPair(resourceName, names.AttrUsername, sourceDbResourceName, names.AttrUsername), resource.TestCheckResourceAttrPair(resourceName, "db_name", sourceDbResourceName, "db_name"), resource.TestCheckResourceAttrPair(resourceName, "maintenance_window", sourceDbResourceName, "maintenance_window"), resource.TestCheckResourceAttrPair(resourceName, "option_group_name", sourceDbResourceName, "option_group_name"), - resource.TestCheckResourceAttrPair(resourceName, "parameter_group_name", sourceDbResourceName, "parameter_group_name"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrParameterGroupName, sourceDbResourceName, names.AttrParameterGroupName), resource.TestCheckResourceAttrPair(resourceName, names.AttrPort, sourceDbResourceName, names.AttrPort), ), }, @@ -2553,7 +2553,7 @@ func TestAccRDSInstance_SnapshotIdentifier_AssociationRemoved(t *testing.T) { testAccCheckInstanceExists(ctx, resourceName, &dbInstance2), testAccCheckDBInstanceNotRecreated(&dbInstance1, &dbInstance2), resource.TestCheckResourceAttrPair(resourceName, "allocated_storage", sourceDbResourceName, "allocated_storage"), - resource.TestCheckResourceAttrPair(resourceName, "engine", sourceDbResourceName, "engine"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrEngine, sourceDbResourceName, names.AttrEngine), resource.TestCheckResourceAttrPair(resourceName, names.AttrUsername, sourceDbResourceName, names.AttrUsername), ), }, @@ -3228,7 +3228,7 @@ func TestAccRDSInstance_SnapshotIdentifier_parameterGroupName(t *testing.T) { testAccCheckInstanceExists(ctx, sourceDbResourceName, &sourceDbInstance), testAccCheckDBSnapshotExists(ctx, snapshotResourceName, &dbSnapshot), testAccCheckInstanceExists(ctx, resourceName, &dbInstance), - resource.TestCheckResourceAttr(resourceName, "parameter_group_name", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrParameterGroupName, rName), testAccCheckInstanceParameterApplyStatusInSync(&dbInstance), ), }, @@ -3751,7 +3751,7 @@ func TestAccRDSInstance_MSSQL_tz(t *testing.T) { testAccCheckInstanceExists(ctx, resourceName, &v), testAccCheckInstanceAttributes_MSSQL(&v, ""), resource.TestCheckResourceAttr(resourceName, "allocated_storage", "20"), - resource.TestCheckResourceAttr(resourceName, "engine", tfrds.InstanceEngineSQLServerExpress), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, tfrds.InstanceEngineSQLServerExpress), ), }, @@ -3761,7 +3761,7 @@ func TestAccRDSInstance_MSSQL_tz(t *testing.T) { testAccCheckInstanceExists(ctx, resourceName, &v), testAccCheckInstanceAttributes_MSSQL(&v, "Alaskan Standard Time"), resource.TestCheckResourceAttr(resourceName, "allocated_storage", "20"), - resource.TestCheckResourceAttr(resourceName, "engine", tfrds.InstanceEngineSQLServerExpress), + resource.TestCheckResourceAttr(resourceName, names.AttrEngine, tfrds.InstanceEngineSQLServerExpress), ), }, }, @@ -5236,7 +5236,7 @@ func TestAccRDSInstance_BlueGreenDeployment_updateParameterGroup(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExists(ctx, resourceName, &v1), resource.TestCheckResourceAttr(resourceName, "backup_retention_period", acctest.Ct1), - resource.TestCheckResourceAttrPair(resourceName, "parameter_group_name", parameterGroupDataSource, names.AttrName), + resource.TestCheckResourceAttrPair(resourceName, names.AttrParameterGroupName, parameterGroupDataSource, names.AttrName), ), }, { @@ -5244,7 +5244,7 @@ func TestAccRDSInstance_BlueGreenDeployment_updateParameterGroup(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExists(ctx, resourceName, &v2), testAccCheckDBInstanceRecreated(&v1, &v2), - resource.TestCheckResourceAttrPair(resourceName, "parameter_group_name", parameterGroupResourceName, names.AttrName), + resource.TestCheckResourceAttrPair(resourceName, names.AttrParameterGroupName, parameterGroupResourceName, names.AttrName), resource.TestCheckResourceAttr(resourceName, "blue_green_update.0.enabled", acctest.CtTrue), ), }, diff --git a/internal/service/rds/orderable_instance_data_source.go b/internal/service/rds/orderable_instance_data_source.go index fd40c0047d5..3f9a707632c 100644 --- a/internal/service/rds/orderable_instance_data_source.go +++ b/internal/service/rds/orderable_instance_data_source.go @@ -35,7 +35,7 @@ func DataSourceOrderableInstance() *schema.Resource { Elem: &schema.Schema{Type: schema.TypeString}, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Required: true, }, @@ -226,7 +226,7 @@ func dataSourceOrderableInstanceRead(ctx context.Context, d *schema.ResourceData input.DBInstanceClass = aws.String(v.(string)) } - if v, ok := d.GetOk("engine"); ok { + if v, ok := d.GetOk(names.AttrEngine); ok { input.Engine = aws.String(v.(string)) } @@ -473,7 +473,7 @@ func dataSourceOrderableInstanceRead(ctx context.Context, d *schema.ResourceData availabilityZones = append(availabilityZones, aws.StringValue(v.Name)) } d.Set(names.AttrAvailabilityZones, availabilityZones) - d.Set("engine", found.Engine) + d.Set(names.AttrEngine, found.Engine) d.Set(names.AttrEngineVersion, found.EngineVersion) d.Set("instance_class", found.DBInstanceClass) d.Set("license_model", found.LicenseModel) diff --git a/internal/service/rds/orderable_instance_data_source_test.go b/internal/service/rds/orderable_instance_data_source_test.go index 99842f09f5a..0dc97dad7bd 100644 --- a/internal/service/rds/orderable_instance_data_source_test.go +++ b/internal/service/rds/orderable_instance_data_source_test.go @@ -35,7 +35,7 @@ func TestAccRDSOrderableInstanceDataSource_basic(t *testing.T) { { Config: testAccOrderableInstanceDataSourceConfig_basic(engine, licenseModel, storageType), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(dataSourceName, "engine", engine), + resource.TestCheckResourceAttr(dataSourceName, names.AttrEngine, engine), resource.TestCheckResourceAttr(dataSourceName, "license_model", licenseModel), resource.TestCheckResourceAttr(dataSourceName, names.AttrStorageType, storageType), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEngineVersion, "data.aws_rds_engine_version.default", names.AttrVersion), @@ -160,7 +160,7 @@ func TestAccRDSOrderableInstanceDataSource_latestVersion(t *testing.T) { { Config: testAccOrderableInstanceDataSourceConfig_latestVersion(false), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(dataSourceName, "engine", tfrds.ClusterEngineAuroraMySQL), + resource.TestCheckResourceAttr(dataSourceName, names.AttrEngine, tfrds.ClusterEngineAuroraMySQL), resource.TestCheckResourceAttr(dataSourceName, "engine_latest_version", acctest.CtFalse), resource.TestMatchResourceAttr(dataSourceName, names.AttrEngineVersion, regexache.MustCompile(`^5\.7\.mysql_aurora\..*`)), ), @@ -168,7 +168,7 @@ func TestAccRDSOrderableInstanceDataSource_latestVersion(t *testing.T) { { Config: testAccOrderableInstanceDataSourceConfig_latestVersion(true), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(dataSourceName, "engine", tfrds.ClusterEngineAuroraMySQL), + resource.TestCheckResourceAttr(dataSourceName, names.AttrEngine, tfrds.ClusterEngineAuroraMySQL), resource.TestCheckResourceAttr(dataSourceName, "engine_latest_version", acctest.CtTrue), resource.TestMatchResourceAttr(dataSourceName, names.AttrEngineVersion, regexache.MustCompile(`^5\.7\.mysql_aurora\..*`)), ), @@ -195,7 +195,7 @@ func TestAccRDSOrderableInstanceDataSource_supportsGlobalDatabases(t *testing.T) Config: testAccOrderableInstanceDataSourceConfig_supportsGlobalDatabases(), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(dataSourceName, "supports_global_databases", acctest.CtTrue), - resource.TestCheckResourceAttr(dataSourceName, "engine", tfrds.ClusterEngineAuroraMySQL), + resource.TestCheckResourceAttr(dataSourceName, names.AttrEngine, tfrds.ClusterEngineAuroraMySQL), resource.TestCheckResourceAttr(dataSourceName, "engine_latest_version", acctest.CtTrue), resource.TestMatchResourceAttr(dataSourceName, names.AttrEngineVersion, regexache.MustCompile(`^8\.0\.mysql_aurora\..*`)), ), @@ -218,7 +218,7 @@ func TestAccRDSOrderableInstanceDataSource_supportsClusters(t *testing.T) { Config: testAccOrderableInstanceDataSourceConfig_supportsClusters(), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(dataSourceName, "supports_clusters", acctest.CtTrue), - resource.TestCheckResourceAttr(dataSourceName, "engine", tfrds.ClusterEngineMySQL), + resource.TestCheckResourceAttr(dataSourceName, names.AttrEngine, tfrds.ClusterEngineMySQL), resource.TestCheckResourceAttr(dataSourceName, "engine_latest_version", acctest.CtTrue), resource.TestMatchResourceAttr(dataSourceName, "instance_class", regexache.MustCompile(`^db\..*large$`)), ), @@ -241,7 +241,7 @@ func TestAccRDSOrderableInstanceDataSource_readReplicaCapable(t *testing.T) { Config: testAccOrderableInstanceDataSourceConfig_readReplicaCapable(), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(dataSourceName, "read_replica_capable", acctest.CtTrue), - resource.TestCheckResourceAttr(dataSourceName, "engine", tfrds.InstanceEngineOracleEnterprise), + resource.TestCheckResourceAttr(dataSourceName, names.AttrEngine, tfrds.InstanceEngineOracleEnterprise), resource.TestCheckResourceAttr(dataSourceName, "engine_latest_version", acctest.CtTrue), resource.TestCheckResourceAttrSet(dataSourceName, "instance_class"), ), @@ -264,7 +264,7 @@ func TestAccRDSOrderableInstanceDataSource_supportsMultiAZ(t *testing.T) { Config: testAccOrderableInstanceDataSourceConfig_supportsMultiAZ(), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(dataSourceName, "supports_multi_az", acctest.CtTrue), - resource.TestCheckResourceAttr(dataSourceName, "engine", tfrds.ClusterEngineMySQL), + resource.TestCheckResourceAttr(dataSourceName, names.AttrEngine, tfrds.ClusterEngineMySQL), resource.TestCheckResourceAttr(dataSourceName, "engine_latest_version", acctest.CtTrue), ), }, @@ -285,7 +285,7 @@ func TestAccRDSOrderableInstanceDataSource_supportedEngineModes(t *testing.T) { { Config: testAccOrderableInstanceDataSourceConfig_supportedEngineModes(), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(dataSourceName, "engine", tfrds.ClusterEngineAuroraPostgreSQL), + resource.TestCheckResourceAttr(dataSourceName, names.AttrEngine, tfrds.ClusterEngineAuroraPostgreSQL), resource.TestCheckResourceAttr(dataSourceName, "engine_latest_version", acctest.CtTrue), resource.TestCheckResourceAttr(dataSourceName, "supported_engine_modes.0", "provisioned"), ), @@ -307,7 +307,7 @@ func TestAccRDSOrderableInstanceDataSource_supportedNetworkTypes(t *testing.T) { { Config: testAccOrderableInstanceDataSourceConfig_supportedNetworkTypes(), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(dataSourceName, "engine", tfrds.ClusterEngineAuroraPostgreSQL), + resource.TestCheckResourceAttr(dataSourceName, names.AttrEngine, tfrds.ClusterEngineAuroraPostgreSQL), resource.TestCheckResourceAttr(dataSourceName, "engine_latest_version", acctest.CtTrue), resource.TestCheckTypeSetElemAttr(dataSourceName, "supported_network_types.*", "DUAL"), ), diff --git a/internal/service/rds/snapshot.go b/internal/service/rds/snapshot.go index 488f1a5a73e..0be63464ac4 100644 --- a/internal/service/rds/snapshot.go +++ b/internal/service/rds/snapshot.go @@ -68,7 +68,7 @@ func ResourceSnapshot() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Computed: true, }, @@ -194,7 +194,7 @@ func resourceSnapshotRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set("db_snapshot_arn", arn) d.Set("db_snapshot_identifier", snapshot.DBSnapshotIdentifier) d.Set(names.AttrEncrypted, snapshot.Encrypted) - d.Set("engine", snapshot.Engine) + d.Set(names.AttrEngine, snapshot.Engine) d.Set(names.AttrEngineVersion, snapshot.EngineVersion) d.Set(names.AttrIOPS, snapshot.Iops) d.Set(names.AttrKMSKeyID, snapshot.KmsKeyId) diff --git a/internal/service/rds/snapshot_copy.go b/internal/service/rds/snapshot_copy.go index bada1092574..501af7409d1 100644 --- a/internal/service/rds/snapshot_copy.go +++ b/internal/service/rds/snapshot_copy.go @@ -67,7 +67,7 @@ func ResourceSnapshotCopy() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Computed: true, }, @@ -212,7 +212,7 @@ func resourceSnapshotCopyRead(ctx context.Context, d *schema.ResourceData, meta d.Set(names.AttrAvailabilityZone, snapshot.AvailabilityZone) d.Set("db_snapshot_arn", arn) d.Set(names.AttrEncrypted, snapshot.Encrypted) - d.Set("engine", snapshot.Engine) + d.Set(names.AttrEngine, snapshot.Engine) d.Set(names.AttrEngineVersion, snapshot.EngineVersion) d.Set(names.AttrIOPS, snapshot.Iops) d.Set(names.AttrKMSKeyID, snapshot.KmsKeyId) diff --git a/internal/service/rds/snapshot_data_source.go b/internal/service/rds/snapshot_data_source.go index a94be4b6d28..3363545e2a5 100644 --- a/internal/service/rds/snapshot_data_source.go +++ b/internal/service/rds/snapshot_data_source.go @@ -50,7 +50,7 @@ func DataSourceSnapshot() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "engine": { + names.AttrEngine: { Type: schema.TypeString, Computed: true, }, @@ -186,7 +186,7 @@ func dataSourceSnapshotRead(ctx context.Context, d *schema.ResourceData, meta in d.Set("db_snapshot_arn", snapshot.DBSnapshotArn) d.Set("db_snapshot_identifier", snapshot.DBSnapshotIdentifier) d.Set(names.AttrEncrypted, snapshot.Encrypted) - d.Set("engine", snapshot.Engine) + d.Set(names.AttrEngine, snapshot.Engine) d.Set(names.AttrEngineVersion, snapshot.EngineVersion) d.Set(names.AttrIOPS, snapshot.Iops) d.Set(names.AttrKMSKeyID, snapshot.KmsKeyId) diff --git a/internal/service/redshift/endpoint_access.go b/internal/service/redshift/endpoint_access.go index 50d08047fee..0c564ce74ae 100644 --- a/internal/service/redshift/endpoint_access.go +++ b/internal/service/redshift/endpoint_access.go @@ -56,7 +56,7 @@ func resourceEndpointAccess() *schema.Resource { Type: schema.TypeInt, Computed: true, }, - "resource_owner": { + names.AttrResourceOwner: { Type: schema.TypeString, ForceNew: true, Optional: true, @@ -134,7 +134,7 @@ func resourceEndpointAccessCreate(ctx context.Context, d *schema.ResourceData, m createOpts.ClusterIdentifier = aws.String(v.(string)) } - if v, ok := d.GetOk("resource_owner"); ok { + if v, ok := d.GetOk(names.AttrResourceOwner); ok { createOpts.ResourceOwner = aws.String(v.(string)) } @@ -172,7 +172,7 @@ func resourceEndpointAccessRead(ctx context.Context, d *schema.ResourceData, met d.Set("endpoint_name", endpoint.EndpointName) d.Set("subnet_group_name", endpoint.SubnetGroupName) d.Set(names.AttrVPCSecurityGroupIDs, vpcSgsIdsToSlice(endpoint.VpcSecurityGroups)) - d.Set("resource_owner", endpoint.ResourceOwner) + d.Set(names.AttrResourceOwner, endpoint.ResourceOwner) d.Set(names.AttrClusterIdentifier, endpoint.ClusterIdentifier) d.Set(names.AttrPort, endpoint.Port) d.Set(names.AttrAddress, endpoint.Address) diff --git a/internal/service/route53resolver/endpoint_data_source.go b/internal/service/route53resolver/endpoint_data_source.go index 3096abeb12d..7ca75b0454b 100644 --- a/internal/service/route53resolver/endpoint_data_source.go +++ b/internal/service/route53resolver/endpoint_data_source.go @@ -46,7 +46,7 @@ func DataSourceEndpoint() *schema.Resource { }, }, }, - "ip_addresses": { + names.AttrIPAddresses: { Type: schema.TypeSet, Elem: &schema.Schema{Type: schema.TypeString}, Computed: true, @@ -143,7 +143,7 @@ func dataSourceEndpointRead(ctx context.Context, d *schema.ResourceData, meta in ips = append(ips, v.Ip) } - d.Set("ip_addresses", aws.StringValueSlice(ips)) + d.Set(names.AttrIPAddresses, aws.StringValueSlice(ips)) return nil } diff --git a/internal/service/s3/bucket_accelerate_configuration.go b/internal/service/s3/bucket_accelerate_configuration.go index 75360c17987..b1f86d36f14 100644 --- a/internal/service/s3/bucket_accelerate_configuration.go +++ b/internal/service/s3/bucket_accelerate_configuration.go @@ -41,7 +41,7 @@ func resourceBucketAccelerateConfiguration() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 63), }, - "expected_bucket_owner": { + names.AttrExpectedBucketOwner: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -60,7 +60,7 @@ func resourceBucketAccelerateConfigurationCreate(ctx context.Context, d *schema. conn := meta.(*conns.AWSClient).S3Client(ctx) bucket := d.Get(names.AttrBucket).(string) - expectedBucketOwner := d.Get("expected_bucket_owner").(string) + expectedBucketOwner := d.Get(names.AttrExpectedBucketOwner).(string) input := &s3.PutBucketAccelerateConfigurationInput{ Bucket: aws.String(bucket), AccelerateConfiguration: &types.AccelerateConfiguration{ @@ -117,7 +117,7 @@ func resourceBucketAccelerateConfigurationRead(ctx context.Context, d *schema.Re } d.Set(names.AttrBucket, bucket) - d.Set("expected_bucket_owner", expectedBucketOwner) + d.Set(names.AttrExpectedBucketOwner, expectedBucketOwner) d.Set(names.AttrStatus, output.Status) return nil diff --git a/internal/service/s3/bucket_acl.go b/internal/service/s3/bucket_acl.go index 6068c16c060..a8a820dbd1e 100644 --- a/internal/service/s3/bucket_acl.go +++ b/internal/service/s3/bucket_acl.go @@ -126,7 +126,7 @@ func resourceBucketACL() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 63), }, - "expected_bucket_owner": { + names.AttrExpectedBucketOwner: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -151,7 +151,7 @@ func resourceBucketACLCreate(ctx context.Context, d *schema.ResourceData, meta i conn := meta.(*conns.AWSClient).S3Client(ctx) bucket := d.Get(names.AttrBucket).(string) - expectedBucketOwner := d.Get("expected_bucket_owner").(string) + expectedBucketOwner := d.Get(names.AttrExpectedBucketOwner).(string) acl := d.Get("acl").(string) input := &s3.PutBucketAclInput{ Bucket: aws.String(bucket), @@ -217,7 +217,7 @@ func resourceBucketACLRead(ctx context.Context, d *schema.ResourceData, meta int } d.Set("acl", acl) d.Set(names.AttrBucket, bucket) - d.Set("expected_bucket_owner", expectedBucketOwner) + d.Set(names.AttrExpectedBucketOwner, expectedBucketOwner) return nil } diff --git a/internal/service/s3/bucket_cors_configuration.go b/internal/service/s3/bucket_cors_configuration.go index 6d32fd97ece..611c8d42730 100644 --- a/internal/service/s3/bucket_cors_configuration.go +++ b/internal/service/s3/bucket_cors_configuration.go @@ -41,7 +41,7 @@ func resourceBucketCorsConfiguration() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 63), }, - "expected_bucket_owner": { + names.AttrExpectedBucketOwner: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -93,7 +93,7 @@ func resourceBucketCorsConfigurationCreate(ctx context.Context, d *schema.Resour conn := meta.(*conns.AWSClient).S3Client(ctx) bucket := d.Get(names.AttrBucket).(string) - expectedBucketOwner := d.Get("expected_bucket_owner").(string) + expectedBucketOwner := d.Get(names.AttrExpectedBucketOwner).(string) input := &s3.PutBucketCorsInput{ Bucket: aws.String(bucket), CORSConfiguration: &types.CORSConfiguration{ @@ -153,7 +153,7 @@ func resourceBucketCorsConfigurationRead(ctx context.Context, d *schema.Resource if err := d.Set("cors_rule", flattenCORSRules(corsRules)); err != nil { return diag.Errorf("setting cors_rule: %s", err) } - d.Set("expected_bucket_owner", expectedBucketOwner) + d.Set(names.AttrExpectedBucketOwner, expectedBucketOwner) return nil } diff --git a/internal/service/s3/bucket_lifecycle_configuration.go b/internal/service/s3/bucket_lifecycle_configuration.go index 31001a793e6..07dfeace6f2 100644 --- a/internal/service/s3/bucket_lifecycle_configuration.go +++ b/internal/service/s3/bucket_lifecycle_configuration.go @@ -53,7 +53,7 @@ func resourceBucketLifecycleConfiguration() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 63), }, - "expected_bucket_owner": { + names.AttrExpectedBucketOwner: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -259,7 +259,7 @@ func resourceBucketLifecycleConfigurationCreate(ctx context.Context, d *schema.R conn := meta.(*conns.AWSClient).S3Client(ctx) bucket := d.Get(names.AttrBucket).(string) - expectedBucketOwner := d.Get("expected_bucket_owner").(string) + expectedBucketOwner := d.Get(names.AttrExpectedBucketOwner).(string) rules := expandLifecycleRules(ctx, d.Get(names.AttrRule).([]interface{})) input := &s3.PutBucketLifecycleConfigurationInput{ Bucket: aws.String(bucket), @@ -346,7 +346,7 @@ func resourceBucketLifecycleConfigurationRead(ctx context.Context, d *schema.Res } d.Set(names.AttrBucket, bucket) - d.Set("expected_bucket_owner", expectedBucketOwner) + d.Set(names.AttrExpectedBucketOwner, expectedBucketOwner) if err := d.Set(names.AttrRule, flattenLifecycleRules(ctx, output)); err != nil { return diag.Errorf("setting rule: %s", err) } diff --git a/internal/service/s3/bucket_logging.go b/internal/service/s3/bucket_logging.go index 8995dae95b7..00d821b76cd 100644 --- a/internal/service/s3/bucket_logging.go +++ b/internal/service/s3/bucket_logging.go @@ -42,7 +42,7 @@ func resourceBucketLogging() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 63), }, - "expected_bucket_owner": { + names.AttrExpectedBucketOwner: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -141,7 +141,7 @@ func resourceBucketLoggingCreate(ctx context.Context, d *schema.ResourceData, me conn := meta.(*conns.AWSClient).S3Client(ctx) bucket := d.Get(names.AttrBucket).(string) - expectedBucketOwner := d.Get("expected_bucket_owner").(string) + expectedBucketOwner := d.Get(names.AttrExpectedBucketOwner).(string) input := &s3.PutBucketLoggingInput{ Bucket: aws.String(bucket), BucketLoggingStatus: &types.BucketLoggingStatus{ @@ -210,7 +210,7 @@ func resourceBucketLoggingRead(ctx context.Context, d *schema.ResourceData, meta } d.Set(names.AttrBucket, bucket) - d.Set("expected_bucket_owner", expectedBucketOwner) + d.Set(names.AttrExpectedBucketOwner, expectedBucketOwner) d.Set("target_bucket", loggingEnabled.TargetBucket) if err := d.Set("target_grant", flattenTargetGrants(loggingEnabled.TargetGrants)); err != nil { return sdkdiag.AppendErrorf(diags, "setting target_grant: %s", err) diff --git a/internal/service/s3/bucket_logging_test.go b/internal/service/s3/bucket_logging_test.go index 3eae075abf1..b61d4569672 100644 --- a/internal/service/s3/bucket_logging_test.go +++ b/internal/service/s3/bucket_logging_test.go @@ -36,7 +36,7 @@ func TestAccS3BucketLogging_basic(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckBucketLoggingExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, names.AttrBucket, rName), - resource.TestCheckResourceAttr(resourceName, "expected_bucket_owner", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrExpectedBucketOwner, ""), resource.TestCheckResourceAttrPair(resourceName, "target_bucket", "aws_s3_bucket.log_bucket", names.AttrBucket), resource.TestCheckResourceAttr(resourceName, "target_grant.#", acctest.Ct0), resource.TestCheckResourceAttr(resourceName, "target_object_key_format.#", acctest.Ct0), @@ -373,7 +373,7 @@ func TestAccS3BucketLogging_withExpectedBucketOwner(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckBucketLoggingExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, names.AttrBucket, rName), - acctest.CheckResourceAttrAccountID(resourceName, "expected_bucket_owner"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrExpectedBucketOwner), resource.TestCheckResourceAttrPair(resourceName, "target_bucket", "aws_s3_bucket.log_bucket", names.AttrBucket), resource.TestCheckResourceAttr(resourceName, "target_grant.#", acctest.Ct0), resource.TestCheckResourceAttr(resourceName, "target_object_key_format.#", acctest.Ct0), diff --git a/internal/service/s3/bucket_object_lock_configuration.go b/internal/service/s3/bucket_object_lock_configuration.go index ca644bb58fe..50cf3f1993b 100644 --- a/internal/service/s3/bucket_object_lock_configuration.go +++ b/internal/service/s3/bucket_object_lock_configuration.go @@ -42,7 +42,7 @@ func resourceBucketObjectLockConfiguration() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 63), }, - "expected_bucket_owner": { + names.AttrExpectedBucketOwner: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -101,7 +101,7 @@ func resourceBucketObjectLockConfigurationCreate(ctx context.Context, d *schema. conn := meta.(*conns.AWSClient).S3Client(ctx) bucket := d.Get(names.AttrBucket).(string) - expectedBucketOwner := d.Get("expected_bucket_owner").(string) + expectedBucketOwner := d.Get(names.AttrExpectedBucketOwner).(string) input := &s3.PutObjectLockConfigurationInput{ Bucket: aws.String(bucket), ObjectLockConfiguration: &types.ObjectLockConfiguration{ @@ -169,7 +169,7 @@ func resourceBucketObjectLockConfigurationRead(ctx context.Context, d *schema.Re } d.Set(names.AttrBucket, bucket) - d.Set("expected_bucket_owner", expectedBucketOwner) + d.Set(names.AttrExpectedBucketOwner, expectedBucketOwner) d.Set("object_lock_enabled", objLockConfig.ObjectLockEnabled) if err := d.Set(names.AttrRule, flattenObjectLockRule(objLockConfig.Rule)); err != nil { return diag.Errorf("setting rule: %s", err) diff --git a/internal/service/s3/bucket_request_payment_configuration.go b/internal/service/s3/bucket_request_payment_configuration.go index af5a5356d32..4b910e48c33 100644 --- a/internal/service/s3/bucket_request_payment_configuration.go +++ b/internal/service/s3/bucket_request_payment_configuration.go @@ -41,7 +41,7 @@ func resourceBucketRequestPaymentConfiguration() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 63), }, - "expected_bucket_owner": { + names.AttrExpectedBucketOwner: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -60,7 +60,7 @@ func resourceBucketRequestPaymentConfigurationCreate(ctx context.Context, d *sch conn := meta.(*conns.AWSClient).S3Client(ctx) bucket := d.Get(names.AttrBucket).(string) - expectedBucketOwner := d.Get("expected_bucket_owner").(string) + expectedBucketOwner := d.Get(names.AttrExpectedBucketOwner).(string) input := &s3.PutBucketRequestPaymentInput{ Bucket: aws.String(bucket), RequestPaymentConfiguration: &types.RequestPaymentConfiguration{ @@ -117,7 +117,7 @@ func resourceBucketRequestPaymentConfigurationRead(ctx context.Context, d *schem } d.Set(names.AttrBucket, bucket) - d.Set("expected_bucket_owner", expectedBucketOwner) + d.Set(names.AttrExpectedBucketOwner, expectedBucketOwner) d.Set("payer", output.Payer) return nil diff --git a/internal/service/s3/bucket_server_side_encryption_configuration.go b/internal/service/s3/bucket_server_side_encryption_configuration.go index 215ea26f3f1..1ddcb36fdb9 100644 --- a/internal/service/s3/bucket_server_side_encryption_configuration.go +++ b/internal/service/s3/bucket_server_side_encryption_configuration.go @@ -41,7 +41,7 @@ func resourceBucketServerSideEncryptionConfiguration() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 63), }, - "expected_bucket_owner": { + names.AttrExpectedBucketOwner: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -85,7 +85,7 @@ func resourceBucketServerSideEncryptionConfigurationCreate(ctx context.Context, conn := meta.(*conns.AWSClient).S3Client(ctx) bucket := d.Get(names.AttrBucket).(string) - expectedBucketOwner := d.Get("expected_bucket_owner").(string) + expectedBucketOwner := d.Get(names.AttrExpectedBucketOwner).(string) input := &s3.PutBucketEncryptionInput{ Bucket: aws.String(bucket), ServerSideEncryptionConfiguration: &types.ServerSideEncryptionConfiguration{ @@ -142,7 +142,7 @@ func resourceBucketServerSideEncryptionConfigurationRead(ctx context.Context, d } d.Set(names.AttrBucket, bucket) - d.Set("expected_bucket_owner", expectedBucketOwner) + d.Set(names.AttrExpectedBucketOwner, expectedBucketOwner) if err := d.Set(names.AttrRule, flattenServerSideEncryptionRules(sse.Rules)); err != nil { return diag.Errorf("setting rule: %s", err) } diff --git a/internal/service/s3/bucket_versioning.go b/internal/service/s3/bucket_versioning.go index 823238c0a2e..932ce153cf4 100644 --- a/internal/service/s3/bucket_versioning.go +++ b/internal/service/s3/bucket_versioning.go @@ -45,7 +45,7 @@ func resourceBucketVersioning() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 63), }, - "expected_bucket_owner": { + names.AttrExpectedBucketOwner: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -103,7 +103,7 @@ func resourceBucketVersioningCreate(ctx context.Context, d *schema.ResourceData, conn := meta.(*conns.AWSClient).S3Client(ctx) bucket := d.Get(names.AttrBucket).(string) - expectedBucketOwner := d.Get("expected_bucket_owner").(string) + expectedBucketOwner := d.Get(names.AttrExpectedBucketOwner).(string) versioningConfiguration := expandBucketVersioningConfiguration(d.Get("versioning_configuration").([]interface{})) @@ -167,7 +167,7 @@ func resourceBucketVersioningRead(ctx context.Context, d *schema.ResourceData, m } d.Set(names.AttrBucket, bucket) - d.Set("expected_bucket_owner", expectedBucketOwner) + d.Set(names.AttrExpectedBucketOwner, expectedBucketOwner) if err := d.Set("versioning_configuration", flattenVersioning(output)); err != nil { return diag.Errorf("setting versioning_configuration: %s", err) } diff --git a/internal/service/s3/bucket_website_configuration.go b/internal/service/s3/bucket_website_configuration.go index 03560d120d7..525024a3619 100644 --- a/internal/service/s3/bucket_website_configuration.go +++ b/internal/service/s3/bucket_website_configuration.go @@ -56,7 +56,7 @@ func resourceBucketWebsiteConfiguration() *schema.Resource { }, }, }, - "expected_bucket_owner": { + names.AttrExpectedBucketOwner: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -209,7 +209,7 @@ func resourceBucketWebsiteConfigurationCreate(ctx context.Context, d *schema.Res } bucket := d.Get(names.AttrBucket).(string) - expectedBucketOwner := d.Get("expected_bucket_owner").(string) + expectedBucketOwner := d.Get(names.AttrExpectedBucketOwner).(string) input := &s3.PutBucketWebsiteInput{ Bucket: aws.String(bucket), WebsiteConfiguration: websiteConfig, @@ -267,7 +267,7 @@ func resourceBucketWebsiteConfigurationRead(ctx context.Context, d *schema.Resou if err := d.Set("error_document", flattenErrorDocument(output.ErrorDocument)); err != nil { return diag.Errorf("setting error_document: %s", err) } - d.Set("expected_bucket_owner", expectedBucketOwner) + d.Set(names.AttrExpectedBucketOwner, expectedBucketOwner) if err := d.Set("index_document", flattenIndexDocument(output.IndexDocument)); err != nil { return diag.Errorf("setting index_document: %s", err) } diff --git a/internal/service/s3/object_copy.go b/internal/service/s3/object_copy.go index 30ac4148244..e4164dcad0c 100644 --- a/internal/service/s3/object_copy.go +++ b/internal/service/s3/object_copy.go @@ -145,7 +145,7 @@ func resourceObjectCopy() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "expected_bucket_owner": { + names.AttrExpectedBucketOwner: { Type: schema.TypeString, Optional: true, }, @@ -431,7 +431,7 @@ func resourceObjectCopyUpdate(ctx context.Context, d *schema.ResourceData, meta "customer_algorithm", "customer_key", "customer_key_md5", - "expected_bucket_owner", + names.AttrExpectedBucketOwner, "expected_source_bucket_owner", "expires", "grant", @@ -568,7 +568,7 @@ func resourceObjectCopyDoCopy(ctx context.Context, d *schema.ResourceData, meta input.SSECustomerKeyMD5 = aws.String(v.(string)) } - if v, ok := d.GetOk("expected_bucket_owner"); ok { + if v, ok := d.GetOk(names.AttrExpectedBucketOwner); ok { input.ExpectedBucketOwner = aws.String(v.(string)) } diff --git a/internal/service/s3/object_copy_test.go b/internal/service/s3/object_copy_test.go index 3bcb5faafba..7232d7dacbc 100644 --- a/internal/service/s3/object_copy_test.go +++ b/internal/service/s3/object_copy_test.go @@ -60,7 +60,7 @@ func TestAccS3ObjectCopy_basic(t *testing.T) { resource.TestCheckNoResourceAttr(resourceName, "customer_key"), resource.TestCheckResourceAttr(resourceName, "customer_key_md5", ""), resource.TestCheckResourceAttrPair(resourceName, "etag", sourceName, "etag"), - resource.TestCheckNoResourceAttr(resourceName, "expected_bucket_owner"), + resource.TestCheckNoResourceAttr(resourceName, names.AttrExpectedBucketOwner), resource.TestCheckNoResourceAttr(resourceName, "expected_source_bucket_owner"), resource.TestCheckResourceAttr(resourceName, "expiration", ""), resource.TestCheckNoResourceAttr(resourceName, "expires"), @@ -411,7 +411,7 @@ func TestAccS3ObjectCopy_directoryBucket(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "customer_algorithm", ""), resource.TestCheckNoResourceAttr(resourceName, "customer_key"), resource.TestCheckResourceAttr(resourceName, "customer_key_md5", ""), - resource.TestCheckNoResourceAttr(resourceName, "expected_bucket_owner"), + resource.TestCheckNoResourceAttr(resourceName, names.AttrExpectedBucketOwner), resource.TestCheckNoResourceAttr(resourceName, "expected_source_bucket_owner"), resource.TestCheckResourceAttr(resourceName, "expiration", ""), resource.TestCheckNoResourceAttr(resourceName, "expires"), @@ -483,7 +483,7 @@ func TestAccS3ObjectCopy_basicViaAccessPoint(t *testing.T) { resource.TestCheckNoResourceAttr(resourceName, "customer_key"), resource.TestCheckResourceAttr(resourceName, "customer_key_md5", ""), resource.TestCheckResourceAttrPair(resourceName, "etag", sourceName, "etag"), - resource.TestCheckNoResourceAttr(resourceName, "expected_bucket_owner"), + resource.TestCheckNoResourceAttr(resourceName, names.AttrExpectedBucketOwner), resource.TestCheckNoResourceAttr(resourceName, "expected_source_bucket_owner"), resource.TestCheckResourceAttr(resourceName, "expiration", ""), resource.TestCheckNoResourceAttr(resourceName, "expires"), diff --git a/internal/service/securityhub/automation_rule.go b/internal/service/securityhub/automation_rule.go index 6336ff977ef..03094f50e48 100644 --- a/internal/service/securityhub/automation_rule.go +++ b/internal/service/securityhub/automation_rule.go @@ -198,7 +198,7 @@ func (r *automationRuleResource) Schema(ctx context.Context, request resource.Sc }, NestedObject: schema.NestedBlockObject{ Blocks: map[string]schema.Block{ - "aws_account_id": stringFilterSchemaFramework(ctx), + names.AttrAWSAccountID: stringFilterSchemaFramework(ctx), "aws_account_name": stringFilterSchemaFramework(ctx), "company_name": stringFilterSchemaFramework(ctx), "compliance_associated_standards_id": stringFilterSchemaFramework(ctx), diff --git a/internal/service/securityhub/insight.go b/internal/service/securityhub/insight.go index 6a3646edeb7..3bf7c49b5e4 100644 --- a/internal/service/securityhub/insight.go +++ b/internal/service/securityhub/insight.go @@ -45,7 +45,7 @@ func resourceInsight() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "aws_account_id": stringFilterSchema(), + names.AttrAWSAccountID: stringFilterSchema(), "company_name": stringFilterSchema(), "compliance_status": stringFilterSchema(), "confidence": numberFilterSchema(), @@ -506,7 +506,7 @@ func expandSecurityFindingFilters(l []interface{}) *types.AwsSecurityFindingFilt filters := &types.AwsSecurityFindingFilters{} - if v, ok := tfMap["aws_account_id"].(*schema.Set); ok && v.Len() > 0 { + if v, ok := tfMap[names.AttrAWSAccountID].(*schema.Set); ok && v.Len() > 0 { filters.AwsAccountId = expandStringFilters(v.List()) } @@ -1138,7 +1138,7 @@ func flattenSecurityFindingFilters(filters *types.AwsSecurityFindingFilters) []i } m := map[string]interface{}{ - "aws_account_id": flattenStringFilters(filters.AwsAccountId), + names.AttrAWSAccountID: flattenStringFilters(filters.AwsAccountId), "company_name": flattenStringFilters(filters.CompanyName), "compliance_status": flattenStringFilters(filters.ComplianceStatus), "confidence": flattenNumberFilters(filters.Confidence), diff --git a/internal/service/serverlessrepo/application_data_source.go b/internal/service/serverlessrepo/application_data_source.go index d5e82865ece..9f256155c4b 100644 --- a/internal/service/serverlessrepo/application_data_source.go +++ b/internal/service/serverlessrepo/application_data_source.go @@ -22,7 +22,7 @@ func DataSourceApplication() *schema.Resource { ReadWithoutTimeout: dataSourceApplicationRead, Schema: map[string]*schema.Schema{ - "application_id": { + names.AttrApplicationID: { Type: schema.TypeString, Required: true, ValidateFunc: verify.ValidARN, @@ -58,7 +58,7 @@ func dataSourceApplicationRead(ctx context.Context, d *schema.ResourceData, meta var diags diag.Diagnostics conn := meta.(*conns.AWSClient).ServerlessRepoConn(ctx) - applicationID := d.Get("application_id").(string) + applicationID := d.Get(names.AttrApplicationID).(string) semanticVersion := d.Get("semantic_version").(string) output, err := findApplication(ctx, conn, applicationID, semanticVersion) diff --git a/internal/service/serverlessrepo/cloudformation_stack.go b/internal/service/serverlessrepo/cloudformation_stack.go index 435221830e6..660036c8da9 100644 --- a/internal/service/serverlessrepo/cloudformation_stack.go +++ b/internal/service/serverlessrepo/cloudformation_stack.go @@ -56,7 +56,7 @@ func ResourceCloudFormationStack() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "application_id": { + names.AttrApplicationID: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -158,7 +158,7 @@ func resourceCloudFormationStackRead(ctx context.Context, d *schema.ResourceData var applicationID, semanticVersion string if v, ok := tags[cloudFormationStackTagApplicationID]; ok { applicationID = aws.StringValue(v.Value) - d.Set("application_id", applicationID) + d.Set(names.AttrApplicationID, applicationID) } else { return sdkdiag.AppendErrorf(diags, "describing Serverless Application Repository CloudFormation Stack (%s): missing required tag \"%s\"", d.Id(), cloudFormationStackTagApplicationID) } @@ -303,7 +303,7 @@ func createCloudFormationChangeSet(ctx context.Context, d *schema.ResourceData, stackName := d.Get(names.AttrName).(string) changeSetRequest := serverlessrepo.CreateCloudFormationChangeSetRequest{ StackName: aws.String(stackName), - ApplicationId: aws.String(d.Get("application_id").(string)), + ApplicationId: aws.String(d.Get(names.AttrApplicationID).(string)), Capabilities: flex.ExpandStringSet(d.Get("capabilities").(*schema.Set)), Tags: getTagsIn(ctx), } diff --git a/internal/service/serverlessrepo/cloudformation_stack_test.go b/internal/service/serverlessrepo/cloudformation_stack_test.go index e0c8963304d..f983cebd44f 100644 --- a/internal/service/serverlessrepo/cloudformation_stack_test.go +++ b/internal/service/serverlessrepo/cloudformation_stack_test.go @@ -47,7 +47,7 @@ func TestAccServerlessRepoCloudFormationStack_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckCloudFormationStackExists(ctx, resourceName, &stack), resource.TestCheckResourceAttr(resourceName, names.AttrName, stackName), - acctest.CheckResourceAttrRegionalARNIgnoreRegionAndAccount(resourceName, "application_id", "serverlessrepo", "applications/SecretsManagerRDSPostgreSQLRotationSingleUser"), + acctest.CheckResourceAttrRegionalARNIgnoreRegionAndAccount(resourceName, names.AttrApplicationID, "serverlessrepo", "applications/SecretsManagerRDSPostgreSQLRotationSingleUser"), resource.TestCheckResourceAttrSet(resourceName, "semantic_version"), resource.TestCheckResourceAttr(resourceName, "parameters.%", acctest.Ct2), resource.TestCheckResourceAttr(resourceName, "parameters.functionName", fmt.Sprintf("func-%s", stackName)), @@ -260,7 +260,7 @@ func TestAccServerlessRepoCloudFormationStack_update(t *testing.T) { Config: testAccCloudFormationStackConfig_updateInitial(stackName, appARN, initialName), Check: resource.ComposeTestCheckFunc( testAccCheckCloudFormationStackExists(ctx, resourceName, &stack), - acctest.CheckResourceAttrRegionalARNIgnoreRegionAndAccount(resourceName, "application_id", "serverlessrepo", "applications/SecretsManagerRDSPostgreSQLRotationSingleUser"), + acctest.CheckResourceAttrRegionalARNIgnoreRegionAndAccount(resourceName, names.AttrApplicationID, "serverlessrepo", "applications/SecretsManagerRDSPostgreSQLRotationSingleUser"), resource.TestCheckResourceAttr(resourceName, "parameters.functionName", initialName), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct1), resource.TestCheckResourceAttr(resourceName, "tags.key", names.AttrValue), diff --git a/internal/service/workspaces/connection_alias.go b/internal/service/workspaces/connection_alias.go index 8d2e3d78762..a6a9f582fa4 100644 --- a/internal/service/workspaces/connection_alias.go +++ b/internal/service/workspaces/connection_alias.go @@ -67,7 +67,7 @@ func (r *resourceConnectionAlias) Schema(ctx context.Context, req resource.Schem }, Description: "The connection string specified for the connection alias. The connection string must be in the form of a fully qualified domain name (FQDN), such as www.example.com.", }, - "owner_account_id": schema.StringAttribute{ + names.AttrOwnerAccountID: schema.StringAttribute{ Computed: true, Description: "The identifier of the Amazon Web Services account that owns the connection alias.", PlanModifiers: []planmodifier.String{ diff --git a/internal/service/workspaces/connection_alias_test.go b/internal/service/workspaces/connection_alias_test.go index c7500367e20..9abea69ab25 100644 --- a/internal/service/workspaces/connection_alias_test.go +++ b/internal/service/workspaces/connection_alias_test.go @@ -44,7 +44,7 @@ func TestAccWorkSpacesConnectionAlias_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckConnectionAliasExists(ctx, resourceName, &connectionalias), resource.TestCheckResourceAttr(resourceName, "connection_string", rName), - resource.TestCheckResourceAttrSet(resourceName, "owner_account_id"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrOwnerAccountID), resource.TestCheckResourceAttrSet(resourceName, names.AttrState), ), }, diff --git a/names/attr_constants.csv b/names/attr_constants.csv index 53574cef4bd..ca569c05341 100644 --- a/names/attr_constants.csv +++ b/names/attr_constants.csv @@ -3,6 +3,7 @@ account_id,AccountID action,Action address,Address alias,Alias +application_id,ApplicationID apply_immediately,ApplyImmediately arn,ARN arns,ARNs @@ -10,6 +11,7 @@ attributes,Attributes auto_minor_version_upgrade,AutoMinorVersionUpgrade availability_zone,AvailabilityZone availability_zones,AvailabilityZones +aws_account_id,AWSAccountID bucket,Bucket bucket_name,BucketName bucket_prefix,BucketPrefix @@ -53,9 +55,11 @@ encryption_configuration,EncryptionConfiguration endpoint,Endpoint endpoint_type,EndpointType endpoints,Endpoints +engine,Engine engine_version,EngineVersion environment,Environment execution_role_arn,ExecutionRoleARN +expected_bucket_owner,ExpectedBucketOwner expression,Expression external_id,ExternalID family,Family @@ -81,6 +85,7 @@ interval,Interval iops,IOPS ip_address,IPAddress ip_address_type,IPAddressType +ip_addresses,IPAddresses issuer,Issuer json,JSON key,Key @@ -107,8 +112,10 @@ namespace,Namespace network_configuration,NetworkConfiguration network_interface_id,NetworkInterfaceID owner,Owner +owner_account_id,OwnerAccountID owner_id,OwnerID parameter,Parameter +parameter_group_name,ParameterGroupName parameters,Parameters password,Password path,Path @@ -131,6 +138,7 @@ region,Region repository_name,RepositoryName resource_arn,ResourceARN resource_id,ResourceID +resource_owner,ResourceOwner resource_tags,ResourceTags resource_type,ResourceType resources,Resources @@ -168,6 +176,7 @@ status,Status status_code,StatusCode status_message,StatusMessage status_reason,StatusReason +storage_encrypted,StorageEncrypted storage_type,StorageType stream_arn,StreamARN subnet_id,SubnetID @@ -178,6 +187,7 @@ tags,Tags tags_all,TagsAll target,Target target_arn,TargetARN +throughput,Throughput timeout,Timeout timeouts,Timeouts topic_arn,TopicARN diff --git a/names/attr_consts_gen.go b/names/attr_consts_gen.go index 3c410a78173..496dcc92351 100644 --- a/names/attr_consts_gen.go +++ b/names/attr_consts_gen.go @@ -11,11 +11,13 @@ import ( const ( AttrARN = "arn" AttrARNs = "arns" + AttrAWSAccountID = "aws_account_id" AttrAccessKey = "access_key" AttrAccountID = "account_id" AttrAction = "action" AttrAddress = "address" AttrAlias = "alias" + AttrApplicationID = "application_id" AttrApplyImmediately = "apply_immediately" AttrAttributes = "attributes" AttrAutoMinorVersionUpgrade = "auto_minor_version_upgrade" @@ -64,9 +66,11 @@ const ( AttrEndpoint = "endpoint" AttrEndpointType = "endpoint_type" AttrEndpoints = "endpoints" + AttrEngine = "engine" AttrEngineVersion = "engine_version" AttrEnvironment = "environment" AttrExecutionRoleARN = "execution_role_arn" + AttrExpectedBucketOwner = "expected_bucket_owner" AttrExpression = "expression" AttrExternalID = "external_id" AttrFamily = "family" @@ -87,6 +91,7 @@ const ( AttrIOPS = "iops" AttrIPAddress = "ip_address" AttrIPAddressType = "ip_address_type" + AttrIPAddresses = "ip_addresses" AttrIdentifier = "identifier" AttrInstanceCount = "instance_count" AttrInstanceID = "instance_id" @@ -118,8 +123,10 @@ const ( AttrNetworkConfiguration = "network_configuration" AttrNetworkInterfaceID = "network_interface_id" AttrOwner = "owner" + AttrOwnerAccountID = "owner_account_id" AttrOwnerID = "owner_id" AttrParameter = "parameter" + AttrParameterGroupName = "parameter_group_name" AttrParameters = "parameters" AttrPassword = "password" AttrPath = "path" @@ -142,6 +149,7 @@ const ( AttrRepositoryName = "repository_name" AttrResourceARN = "resource_arn" AttrResourceID = "resource_id" + AttrResourceOwner = "resource_owner" AttrResourceTags = "resource_tags" AttrResourceType = "resource_type" AttrResources = "resources" @@ -179,6 +187,7 @@ const ( AttrStatusCode = "status_code" AttrStatusMessage = "status_message" AttrStatusReason = "status_reason" + AttrStorageEncrypted = "storage_encrypted" AttrStorageType = "storage_type" AttrStreamARN = "stream_arn" AttrSubnetID = "subnet_id" @@ -189,6 +198,7 @@ const ( AttrTagsAll = "tags_all" AttrTarget = "target" AttrTargetARN = "target_arn" + AttrThroughput = "throughput" AttrTimeout = "timeout" AttrTimeouts = "timeouts" AttrTopicARN = "topic_arn" @@ -221,11 +231,13 @@ func ConstOrQuote(constant string) string { allConstants := map[string]string{ "arn": "AttrARN", "arns": "AttrARNs", + "aws_account_id": "AttrAWSAccountID", "access_key": "AttrAccessKey", "account_id": "AttrAccountID", "action": "AttrAction", "address": "AttrAddress", "alias": "AttrAlias", + "application_id": "AttrApplicationID", "apply_immediately": "AttrApplyImmediately", "attributes": "AttrAttributes", "auto_minor_version_upgrade": "AttrAutoMinorVersionUpgrade", @@ -274,9 +286,11 @@ func ConstOrQuote(constant string) string { "endpoint": "AttrEndpoint", "endpoint_type": "AttrEndpointType", "endpoints": "AttrEndpoints", + "engine": "AttrEngine", "engine_version": "AttrEngineVersion", "environment": "AttrEnvironment", "execution_role_arn": "AttrExecutionRoleARN", + "expected_bucket_owner": "AttrExpectedBucketOwner", "expression": "AttrExpression", "external_id": "AttrExternalID", "family": "AttrFamily", @@ -297,6 +311,7 @@ func ConstOrQuote(constant string) string { "iops": "AttrIOPS", "ip_address": "AttrIPAddress", "ip_address_type": "AttrIPAddressType", + "ip_addresses": "AttrIPAddresses", "identifier": "AttrIdentifier", "instance_count": "AttrInstanceCount", "instance_id": "AttrInstanceID", @@ -328,8 +343,10 @@ func ConstOrQuote(constant string) string { "network_configuration": "AttrNetworkConfiguration", "network_interface_id": "AttrNetworkInterfaceID", "owner": "AttrOwner", + "owner_account_id": "AttrOwnerAccountID", "owner_id": "AttrOwnerID", "parameter": "AttrParameter", + "parameter_group_name": "AttrParameterGroupName", "parameters": "AttrParameters", "password": "AttrPassword", "path": "AttrPath", @@ -352,6 +369,7 @@ func ConstOrQuote(constant string) string { "repository_name": "AttrRepositoryName", "resource_arn": "AttrResourceARN", "resource_id": "AttrResourceID", + "resource_owner": "AttrResourceOwner", "resource_tags": "AttrResourceTags", "resource_type": "AttrResourceType", "resources": "AttrResources", @@ -389,6 +407,7 @@ func ConstOrQuote(constant string) string { "status_code": "AttrStatusCode", "status_message": "AttrStatusMessage", "status_reason": "AttrStatusReason", + "storage_encrypted": "AttrStorageEncrypted", "storage_type": "AttrStorageType", "stream_arn": "AttrStreamARN", "subnet_id": "AttrSubnetID", @@ -399,6 +418,7 @@ func ConstOrQuote(constant string) string { "tags_all": "AttrTagsAll", "target": "AttrTarget", "target_arn": "AttrTargetARN", + "throughput": "AttrThroughput", "timeout": "AttrTimeout", "timeouts": "AttrTimeouts", "topic_arn": "AttrTopicARN",